code
stringlengths 12
2.05k
| label_name
stringclasses 5
values | label
int64 0
4
|
---|---|---|
function testCommandCategorieExistence ($name = NULL) {
global $pearDB, $form;
$id = NULL;
if (isset($form))
$id = $form->getSubmitValue('cmd_category_id');
$DBRESULT = $pearDB->query("SELECT `category_name`, `cmd_category_id` FROM `command_categories` WHERE `category_name` = '".htmlentities($name, ENT_QUOTES, "UTF-8")."'");
$cat = $DBRESULT->fetchRow();
if ($DBRESULT->numRows() >= 1 && $cat["cmd_category_id"] == $id)
return true;
else if ($DBRESULT->numRows() >= 1 && $cat["cmd_category_id"] != $id)
return false;
else
return true;
} | Base | 1 |
public function approve_toggle() {
if (empty($this->params['id'])) return;
/* The global constants can be overriden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$comment = new expComment($this->params['id']);
$comment->approved = $comment->approved == 1 ? 0 : 1;
if ($comment->approved) {
$this->sendApprovalNotification($comment,$this->params);
}
$comment->save();
expHistory::back();
} | Base | 1 |
public static function secure()
{
if (!isset($_SESSION['gxsess']['val']['loggedin']) && !isset($_SESSION['gxsess']['val']['username']) ) {
header('location: login.php');
} else {
return true;
}
}
| Base | 1 |
public function LoadHashPaths($tree)
{
if (!$tree)
return;
$treePaths = array();
$blobPaths = array();
$args = array();
$args[] = '--full-name';
$args[] = '-r';
$args[] = '-t';
$args[] = $tree->GetHash();
$lines = explode("\n", $this->exe->Execute($tree->GetProject()->GetPath(), GIT_LS_TREE, $args));
foreach ($lines as $line) {
if (preg_match("/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/", $line, $regs)) {
switch ($regs[2]) {
case 'tree':
$treePaths[trim($regs[4])] = $regs[3];
break;
case 'blob';
$blobPaths[trim($regs[4])] = $regs[3];
break;
}
}
}
return array(
$treePaths,
$blobPaths
);
} | Base | 1 |
public function testCreateRelationshipMeta()
{
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta(null, null, null, array(), null);
self::assertCount(1, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta(null, null, null, array(), 'Contacts');
self::assertCount(1, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta(null, null, null, array(), 'Contacts', true);
self::assertCount(1, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('User', null, null, array(), 'Contacts');
self::assertCount(6, $GLOBALS['log']->calls['fatal']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('User', $this->db, null, array(), 'Contacts');
self::assertNotTrue(isset($GLOBALS['log']->calls['fatal']));
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('Nonexists1', $this->db, null, array(), 'Nonexists2');
self::assertCount(1, $GLOBALS['log']->calls['debug']);
// test
$GLOBALS['log']->reset();
SugarBean::createRelationshipMeta('User', null, null, array(), 'Contacts');
self::assertCount(6, $GLOBALS['log']->calls['fatal']);
} | Base | 1 |
$cLoc = serialize(expCore::makeLocation('container','@section' . $page->id));
$ret .= scan_container($cLoc, $page->id);
$ret .= scan_page($page->id);
}
| Class | 2 |
foreach ($events as $event) {
$extevents[$date][] = $event;
}
| Base | 1 |
$db->insertObject($obj, 'expeAlerts_subscribers');
}
$count = count($this->params['ealerts']);
if ($count > 0) {
flash('message', gt("Your subscriptions have been updated. You are now subscriber to")." ".$count.' '.gt('E-Alerts.'));
} else {
flash('error', gt("You have been unsubscribed from all E-Alerts."));
}
expHistory::back();
} | 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 |
public function checkOverlap()
{
try {
$select = $this->zdb->select(self::TABLE, 'c');
$select->columns(
array('date_debut_cotis', 'date_fin_cotis')
)->join(
array('ct' => PREFIX_DB . ContributionsTypes::TABLE),
'c.' . ContributionsTypes::PK . '=ct.' . ContributionsTypes::PK,
array()
)->where(Adherent::PK . ' = ' . $this->_member)
->where(array('cotis_extension' => new Expression('true')))
->where->nest->nest
->greaterThanOrEqualTo('date_debut_cotis', $this->_begin_date)
->lessThan('date_debut_cotis', $this->_end_date)
->unnest
->or->nest
->greaterThan('date_fin_cotis', $this->_begin_date)
->lessThanOrEqualTo('date_fin_cotis', $this->_end_date);
if ($this->id != '') {
$select->where(self::PK . ' != ' . $this->id);
}
$results = $this->zdb->execute($select);
if ($results->count() > 0) {
$result = $results->current();
$d = new \DateTime($result->date_debut_cotis);
return _T("- Membership period overlaps period starting at ") .
$d->format(__("Y-m-d"));
}
return true;
} catch (Throwable $e) {
Analog::log(
'An error occurred checking overlapping fee. ' . $e->getMessage(),
Analog::ERROR
);
throw $e;
}
} | Base | 1 |
public function withFragment($fragment)
{
if (substr($fragment, 0, 1) === '#') {
$fragment = substr($fragment, 1);
}
$fragment = $this->filterQueryAndFragment($fragment);
if ($this->fragment === $fragment) {
return $this;
}
$new = clone $this;
$new->fragment = $fragment;
return $new;
} | Base | 1 |
public function afterSave($event) {
// look up current tags
$oldTags = $this->getTags();
$newTags = array();
foreach ($this->scanForTags() as $tag) {
if (!in_array($tag, $oldTags)) { // don't add duplicates if there are already tags
$tagModel = new Tags;
$tagModel->tag = $tag; // includes the #
$tagModel->type = get_class($this->getOwner());
$tagModel->itemId = $this->getOwner()->id;
$tagModel->itemName = $this->getOwner()->name;
$tagModel->taggedBy = Yii::app()->getSuName();
$tagModel->timestamp = time();
if ($tagModel->save())
$newTags[] = $tag;
}
}
$this->_tags = $newTags + $oldTags; // update tag cache
if (!empty($newTags) && $this->flowTriggersEnabled) {
X2Flow::trigger('RecordTagAddTrigger', array(
'model' => $this->getOwner(),
'tags' => $newTags,
));
}
} | Class | 2 |
function edit_externalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
}
| Base | 1 |
protected function _mkdir($path, $name)
{
$path = $this->_joinPath($path, $name);
if ($this->connect->mkdir($path) === false) {
return false;
}
$this->options['dirMode'] && $this->connect->chmod($this->options['dirMode'], $path);
return $path;
} | Base | 1 |
public function getAcl($node) {
if (is_string($node)) {
$node = $this->server->tree->getNodeForPath($node);
}
$acl = parent::getAcl($node);
// Authenticated user have read access to all nodes, as node list only contains elements
// that user can read.
$acl[] = [
'principal' => '{DAV:}authenticated',
'privilege' => '{DAV:}read',
'protected' => true,
];
if ($node instanceof Calendar && \Session::haveRight(\PlanningExternalEvent::$rightname, UPDATE)) {
// If user can update external events, then he is able to write on calendar to create new events.
$acl[] = [
'principal' => '{DAV:}authenticated',
'privilege' => '{DAV:}write',
'protected' => true,
];
} else if ($node instanceof CalendarObject) {
$item = $this->getCalendarItemForPath($node->getName());
if ($item instanceof \CommonDBTM && $item->can($item->fields['id'], UPDATE)) {
$acl[] = [
'principal' => '{DAV:}authenticated',
'privilege' => '{DAV:}write',
'protected' => true,
];
}
}
return $acl;
} | Class | 2 |
public function getFormat($mimeType)
{
if (false !== $pos = strpos($mimeType, ';')) {
$mimeType = substr($mimeType, 0, $pos);
}
if (null === static::$formats) {
static::initializeFormats();
}
foreach (static::$formats as $format => $mimeTypes) {
if (in_array($mimeType, (array) $mimeTypes)) {
return $format;
}
}
} | Base | 1 |
public function gc($maxlifetime)
{
$this->getCollection()->remove(array(
$this->options['expiry_field'] => array('$lt' => new \MongoDate()),
));
return true;
} | 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 |
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 static function title($id){
$sql = sprintf("SELECT `title` FROM `posts` WHERE `id` = '%d'", $id);
try
{
$r = Db::result($sql);
if(isset($r['error'])){
$title['error'] = $r['error'];
//echo $title['error'];
}else{
$title = $r[0]->title;
}
}
catch (Exception $e)
{
$title = $e->getMessage();
}
return $title;
}
| Base | 1 |
protected function getSubtask()
{
$subtask = $this->subtaskModel->getById($this->request->getIntegerParam('subtask_id'));
if (empty($subtask)) {
throw new PageNotFoundException();
}
return $subtask;
} | Base | 1 |
public static function delete($id){
$sql = array(
'table' => 'menus',
'where' => array(
'id' => $id
)
);
$menu = Db::delete($sql);
}
| Base | 1 |
function functions_list()
{
$navibars = new navibars();
$navitable = new navitable("functions_list");
$navibars->title(t(244, 'Menus'));
$navibars->add_actions( array( '<a href="?fid='.$_REQUEST['fid'].'&act=2"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> '.t(38, 'Create').'</a>',
'<a href="?fid='.$_REQUEST['fid'].'&act=0"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> '.t(39, 'List').'</a>',
'search_form' ));
if($_REQUEST['quicksearch']=='true')
{
$navitable->setInitialURL("?fid=".$_REQUEST['fid'].'&act=json&_search=true&quicksearch='.$_REQUEST['navigate-quicksearch']);
}
$navitable->setURL('?fid='.$_REQUEST['fid'].'&act=json');
$navitable->sortBy('id');
$navitable->setDataIndex('id');
$navitable->setEditUrl('id', '?fid='.$_REQUEST['fid'].'&act=edit&id=');
$navitable->addCol("ID", 'id', "80", "true", "left");
$navitable->addCol(t(237, 'Code'), 'codename', "100", "true", "left");
$navitable->addCol(t(242, 'Icon'), 'icon', "50", "true", "center");
$navitable->addCol(t(67, 'Title'), 'lid', "200", "true", "left");
$navitable->addCol(t(65, 'Enabled'), 'enabled', "80", "true", "center");
$navibars->add_content($navitable->generate());
return $navibars->generate();
}
| Base | 1 |
private function flatten(iterable $array, array &$result, string $keySeparator, string $parentKey = '', bool $escapeFormulas = false)
{
foreach ($array as $key => $value) {
if (is_iterable($value)) {
$this->flatten($value, $result, $keySeparator, $parentKey.$key.$keySeparator, $escapeFormulas);
} else {
if ($escapeFormulas && \in_array(substr((string) $value, 0, 1), $this->formulasStartCharacters, true)) {
$result[$parentKey.$key] = "\t".$value;
} else {
// Ensures an actual value is used when dealing with true and false
$result[$parentKey.$key] = false === $value ? 0 : (true === $value ? 1 : $value);
}
}
}
} | Base | 1 |
$filename = isset($_REQUEST[$request]) ? trim($_REQUEST[$request]) : false;
if (!$filename || empty($filename)) {
continue;
}
if ($filename == wCMS::get('config', 'theme')) {
wCMS::alert('danger', 'Cannot delete currently active theme.');
wCMS::redirect();
continue;
}
if (file_exists("{$folder}/{$filename}")) {
wCMS::recursiveDelete("{$folder}/{$filename}");
wCMS::alert('success', "Deleted {$filename}.");
wCMS::redirect();
}
}
}
}
}
| Base | 1 |
public function update() {
global $user;
if (expSession::get('customer-signup')) expSession::set('customer-signup', false);
if (isset($this->params['address_country_id'])) {
$this->params['country'] = $this->params['address_country_id'];
unset($this->params['address_country_id']);
}
if (isset($this->params['address_region_id'])) {
$this->params['state'] = $this->params['address_region_id'];
unset($this->params['address_region_id']);
}
if ($user->isLoggedIn()) {
// check to see how many other addresses this user has already.
$count = $this->address->find('count', 'user_id='.$user->id);
// if this is first address save for this user we'll make this the default
if ($count == 0)
{
$this->params['is_default'] = 1;
$this->params['is_billing'] = 1;
$this->params['is_shipping'] = 1;
}
// associate this address with the current user.
$this->params['user_id'] = $user->id;
// save the object
$this->address->update($this->params);
}
else { //if (ecomconfig::getConfig('allow_anonymous_checkout')){
//user is not logged in, but allow anonymous checkout is enabled so we'll check
//a few things that we don't check in the parent 'stuff and create a user account.
$this->params['is_default'] = 1;
$this->params['is_billing'] = 1;
$this->params['is_shipping'] = 1;
$this->address->update($this->params);
}
expHistory::back();
} | Base | 1 |
function getTextColumns($table) {
$sql = "SHOW COLUMNS FROM " . $this->prefix.$table . " WHERE type = 'text' OR type like 'varchar%'";
$res = @mysqli_query($this->connection, $sql);
if ($res == null)
return array();
$records = array();
while($row = mysqli_fetch_object($res)) {
$records[] = $row->Field;
}
return $records;
} | Base | 1 |
private function LoadData()
{
$this->dataLoaded = true;
$args = array();
$args[] = '-s';
$args[] = '-l';
$args[] = $this->commitHash;
$args[] = '--';
$args[] = $this->path;
$blamelines = explode("\n", $this->exe->Execute($this->project->GetPath(), GIT_BLAME, $args));
$lastcommit = '';
foreach ($blamelines as $line) {
if (preg_match('/^([0-9a-fA-F]{40})(\s+.+)?\s+([0-9]+)\)/', $line, $regs)) {
if ($regs[1] != $lastcommit) {
$this->blame[(int)($regs[3])] = $regs[1];
$lastcommit = $regs[1];
}
}
}
} | Base | 1 |
protected function remove($path, $force = false)
{
$stat = $this->stat($path);
if (empty($stat)) {
return $this->setError(elFinder::ERROR_RM, $path, elFinder::ERROR_FILE_NOT_FOUND);
}
$stat['realpath'] = $path;
$this->rmTmb($stat);
$this->clearcache();
if (!$force && !empty($stat['locked'])) {
return $this->setError(elFinder::ERROR_LOCKED, $this->path($stat['hash']));
}
if ($stat['mime'] == 'directory' && empty($stat['thash'])) {
$ret = $this->delTree($this->convEncIn($path));
$this->convEncOut();
if (!$ret) {
return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash']));
}
} else {
if ($this->convEncOut(!$this->_unlink($this->convEncIn($path)))) {
return $this->setError(elFinder::ERROR_RM, $this->path($stat['hash']));
}
$this->clearstatcache();
}
$this->removed[] = $stat;
return true;
} | Base | 1 |
$count += $db->dropTable($basename);
}
flash('message', gt('Deleted').' '.$count.' '.gt('unused tables').'.');
expHistory::back();
} | Base | 1 |
public function delete() {
if (!AuthUser::hasPermission('file_manager_delete')) {
Flash::set('error', __('You do not have sufficient permissions to delete a file or directory.'));
redirect(get_url('plugin/file_manager/browse/'));
}
$paths = func_get_args();
$file = urldecode(join('/', $paths));
// CSRF checks
if (isset($_GET['csrf_token'])) {
$csrf_token = $_GET['csrf_token'];
if (!SecureToken::validateToken($csrf_token, BASE_URL.'plugin/file_manager/delete/'.$file)) {
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/'));
}
$file = FILES_DIR . '/' . str_replace('..', '', $file);
$filename = array_pop($paths);
$paths = join('/', $paths);
if (is_file($file)) {
if (!unlink($file))
Flash::set('error', __('Permission denied!'));
}
else {
if (!$this->_rrmdir($file))
Flash::set('error', __('Permission denied!'));
}
redirect(get_url('plugin/file_manager/browse/' . $paths));
} | 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 |
public function getQuerySelect()
{
return '';
} | Base | 1 |
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$io->title('Kimai installation running ...');
/** @var Application $application */
$application = $this->getApplication();
/** @var KernelInterface $kernel */
$kernel = $application->getKernel();
$environment = $kernel->getEnvironment();
// create the database, in case it is not yet existing
try {
$this->createDatabase($io, $input, $output);
} catch (\Exception $ex) {
$io->error('Failed to create database: ' . $ex->getMessage());
return self::ERROR_DATABASE;
}
// bootstrap database ONLY via doctrine migrations, so all installation will have the correct and same state
try {
$this->importMigrations($io, $output);
} catch (\Exception $ex) {
$io->error('Failed to set migration status: ' . $ex->getMessage());
return self::ERROR_MIGRATIONS;
}
if (!$input->getOption('no-cache')) {
// flush the cache, just to make sure ... and ignore result
$this->rebuildCaches($environment, $io, $input, $output);
}
$io->success(
sprintf('Congratulations! Successfully installed %s version %s (%s)', Constants::SOFTWARE, Constants::VERSION, Constants::STATUS)
);
return 0;
} | Base | 1 |
public static function isPublic($s) {
if ($s == null) {
return false;
}
while ($s->public && $s->parent > 0) {
$s = new section($s->parent);
}
$lineage = (($s->public) ? 1 : 0);
return $lineage;
}
| Base | 1 |
public function testAllowsFalseyUrlParts()
{
$url = new Uri('http://a:1/0?0#0');
$this->assertSame('a', $url->getHost());
$this->assertEquals(1, $url->getPort());
$this->assertSame('/0', $url->getPath());
$this->assertEquals('0', (string) $url->getQuery());
$this->assertSame('0', $url->getFragment());
$this->assertEquals('http://a:1/0?0#0', (string) $url);
$url = new Uri('');
$this->assertSame('', (string) $url);
$url = new Uri('0');
$this->assertSame('0', (string) $url);
$url = new Uri('/');
$this->assertSame('/', (string) $url);
} | Base | 1 |
public function load_from_post()
{
$this->codename = $_REQUEST['codename'];
$this->icon = $_REQUEST['icon'];
$this->lid = $_REQUEST['lid'];
$this->notes = $_REQUEST['notes'];
$this->enabled = ($_REQUEST['enabled']=='1'? '1' : '0');
// load associated functions
$functions = explode('#', $_REQUEST['menu-functions']);
$this->functions = array();
foreach($functions as $function)
{
if(!empty($function))
$this->functions[] = $function;
}
}
| Base | 1 |
public function params()
{
$project = $this->getProject();
$values = $this->request->getValues();
if (empty($values['action_name']) || empty($values['project_id']) || empty($values['event_name'])) {
$this->create();
return;
}
$action = $this->actionManager->getAction($values['action_name']);
$action_params = $action->getActionRequiredParameters();
if (empty($action_params)) {
$this->doCreation($project, $values + array('params' => array()));
}
$projects_list = $this->projectUserRoleModel->getActiveProjectsByUser($this->userSession->getId());
unset($projects_list[$project['id']]);
$this->response->html($this->template->render('action_creation/params', array(
'values' => $values,
'action_params' => $action_params,
'columns_list' => $this->columnModel->getList($project['id']),
'users_list' => $this->projectUserRoleModel->getAssignableUsersList($project['id']),
'projects_list' => $projects_list,
'colors_list' => $this->colorModel->getList(),
'categories_list' => $this->categoryModel->getList($project['id']),
'links_list' => $this->linkModel->getList(0, false),
'priorities_list' => $this->projectTaskPriorityModel->getPriorities($project),
'project' => $project,
'available_actions' => $this->actionManager->getAvailableActions(),
'swimlane_list' => $this->swimlaneModel->getList($project['id']),
'events' => $this->actionManager->getCompatibleEvents($values['action_name']),
)));
} | Class | 2 |
function teampass_whitelist() {
$bdd = teampass_connect();
$apiip_pool = teampass_get_ips();
if (count($apiip_pool) > 0 && !array_search($_SERVER['REMOTE_ADDR'], $apiip_pool)) {
rest_error('IPWHITELIST');
}
} | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$tag_id = $this->request->getIntegerParam('tag_id');
$tag = $this->tagModel->getById($tag_id);
if ($tag['project_id'] != $project['id']) {
throw new AccessForbiddenException();
}
if ($this->tagModel->remove($tag_id)) {
$this->flash->success(t('Tag removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this tag.'));
}
$this->response->redirect($this->helper->url->to('ProjectTagController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
public function fetchSGOrgRow($id, $removable = false, $extend = false)
{
$this->layout = false;
$this->autoRender = false;
$this->set('id', $id);
$this->set('removable', $removable);
$this->set('extend', $extend);
$this->render('ajax/sg_org_row_empty');
} | Base | 1 |
recyclebin::sendToRecycleBin($loc, $parent);
//FIXME if we delete the module & sectionref the module completely disappears
// if (class_exists($secref->module)) {
// $modclass = $secref->module;
// //FIXME: more module/controller glue code
// if (expModules::controllerExists($modclass)) {
// $modclass = expModules::getControllerClassName($modclass);
// $mod = new $modclass($loc->src);
// $mod->delete_instance();
// } else {
// $mod = new $modclass();
// $mod->deleteIn($loc);
// }
// }
}
// $db->delete('sectionref', 'section=' . $parent);
$db->delete('section', 'parent=' . $parent);
}
| Base | 1 |
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 static function makeConfig ($file) {
$config = "<?php if(!defined('GX_LIB')) die(\"Direct Access Not Allowed!\");
/**
* GeniXCMS - Content Management System
*
* PHP Based Content Management System and Framework
*
* @package GeniXCMS
* @since 0.0.1 build date 20140925
* @version 0.0.8
* @link https://github.com/semplon/GeniXCMS
* @link http://genixcms.org
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2016 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/error_reporting(0);
// DB CONFIG
define('DB_HOST', '".Session::val('dbhost')."');
define('DB_NAME', '".Session::val('dbname')."');
define('DB_PASS', '".Session::val('dbpass')."');
define('DB_USER', '".Session::val('dbuser')."');
define('DB_DRIVER', 'mysqli');
define('SMART_URL', false); //set 'true' if you want use SMART URL (SEO Friendly URL)
define('GX_URL_PREFIX', '.html');
// DON't REMOVE or EDIT THIS.
define('SECURITY_KEY', '".Typo::getToken(200)."'); // for security purpose, will be used for creating password
";
try{
$f = fopen($file, "w");
$c = fwrite($f, $config);
fclose($f);
}catch (Exception $e) {
echo $e->getMessage();
}
return $config;
}
| Base | 1 |
$trimmed = trim($line);
if ((strlen($trimmed) > 0) || ($readInitialData === true)) {
$comment[] = $line;
}
$readInitialData = true;
}
switch ($type) {
case 'commit':
$object = $objectHash;
$commitHash = $objectHash;
break;
case 'tag':
$args = array();
$args[] = 'tag';
$args[] = $objectHash;
$ret = $this->exe->Execute($tag->GetProject()->GetPath(), GIT_CAT_FILE, $args);
$lines = explode("\n", $ret);
foreach ($lines as $i => $line) {
if (preg_match('/^tag (.+)$/', $line, $regs)) {
$name = trim($regs[1]);
$object = $name;
}
}
break;
case 'blob':
$object = $objectHash;
break;
}
return array(
$type,
$object,
$commitHash,
$tagger,
$taggerEpoch,
$taggerTimezone,
$comment
);
} | Base | 1 |
$va[] = [$k2 => $m[$v2]];
| Base | 1 |
function db_case($array)
{
global $DatabaseType;
$counter = 0;
if ($DatabaseType == 'mysqli') {
$array_count = count($array);
$string = " CASE WHEN $array[0] =";
$counter++;
$arr_count = count($array);
for ($i = 1; $i < $arr_count; $i++) {
$value = $array[$i];
if ($value == "''" && substr($string, -1) == '=') {
$value = ' IS NULL';
$string = substr($string, 0, -1);
}
$string .= "$value";
if ($counter == ($array_count - 2) && $array_count % 2 == 0)
$string .= " ELSE ";
elseif ($counter == ($array_count - 1))
$string .= " END ";
elseif ($counter % 2 == 0)
$string .= " WHEN $array[0]=";
elseif ($counter % 2 == 1)
$string .= " THEN ";
$counter++;
}
}
return $string;
} | Base | 1 |
public function __construct () {
if (self::existConf()) {
# code...
self::config('config');
self::lang(GX_LANG);
}else{
GxMain::install();
}
} | Compound | 4 |
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 |
function get_allowed_mime_types( $user = null ) {
$t = wp_get_mime_types();
unset( $t['swf'], $t['exe'] );
if ( function_exists( 'current_user_can' ) )
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
if ( empty( $unfiltered ) )
unset( $t['htm|html'] );
/**
* Filters list of allowed mime types and file extensions.
*
* @since 2.0.0
*
* @param array $t Mime types keyed by the file extension regex corresponding to
* those types. 'swf' and 'exe' removed from full list. 'htm|html' also
* removed depending on '$user' capabilities.
* @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
*/
return apply_filters( 'upload_mimes', $t, $user );
} | Base | 1 |
function categoryBreadcrumb() {
// global $db, $router;
//eDebug($this->category);
/*if(isset($router->params['action']))
{
$ancestors = $this->category->pathToNode();
}else if(isset($router->params['section']))
{
$current = $db->selectObject('section',' id= '.$router->params['section']);
$ancestors[] = $current;
if( $current->parent != -1 || $current->parent != 0 )
{
while ($db->selectObject('section',' id= '.$router->params['section']);)
if ($section->id == $id) {
$current = $section;
break;
}
}
}
eDebug($sections);
$ancestors = $this->category->pathToNode();
}*/
$ancestors = $this->category->pathToNode();
// eDebug($ancestors);
assign_to_template(array(
'ancestors' => $ancestors
));
} | Base | 1 |
function info_application($bp_name, $bdd){
$sql = "select * from bp where name = '" . $bp_name . "'";
$req = $bdd->query($sql);
$info = $req->fetch();
echo json_encode($info);
} | Base | 1 |
$comments->records[$key]->avatar = $db->selectObject('user_avatar',"user_id='".$record->poster."'");
}
if (empty($this->params['config']['disable_nested_comments'])) $comments->records = self::arrangecomments($comments->records);
// eDebug($sql, true);
// count the unapproved comments
if ($require_approval == 1 && $user->isAdmin()) {
$sql = 'SELECT count(com.id) as c FROM '.$db->prefix.'expComments com ';
$sql .= 'JOIN '.$db->prefix.'content_expComments cnt ON com.id=cnt.expcomments_id ';
$sql .= 'WHERE cnt.content_id='.$this->params['content_id']." AND cnt.content_type='".$this->params['content_type']."' ";
$sql .= 'AND com.approved=0';
$unapproved = $db->countObjectsBySql($sql);
} else {
$unapproved = 0;
}
$this->config = $this->params['config'];
$type = !empty($this->params['type']) ? $this->params['type'] : gt('Comment');
$ratings = !empty($this->params['ratings']) ? true : false;
assign_to_template(array(
'comments'=>$comments,
'config'=>$this->params['config'],
'unapproved'=>$unapproved,
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'user'=>$user,
'hideform'=>$this->params['hideform'],
'hidecomments'=>$this->params['hidecomments'],
'title'=>$this->params['title'],
'formtitle'=>$this->params['formtitle'],
'type'=>$type,
'ratings'=>$ratings,
'require_login'=>$require_login,
'require_approval'=>$require_approval,
'require_notification'=>$require_notification,
'notification_email'=>$notification_email,
));
} | 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 final function setAction($strAction) {
$this->strAction = $strAction;
} | Base | 1 |
function manage() {
expHistory::set('viewable', $this->params);
// $category = new storeCategory();
// $categories = $category->getFullTree();
//
// // foreach($categories as $i=>$val){
// // if (!empty($this->values) && in_array($val->id,$this->values)) {
// // $this->tags[$i]->value = true;
// // } else {
// // $this->tags[$i]->value = false;
// // }
// // $this->tags[$i]->draggable = $this->draggable;
// // $this->tags[$i]->checkable = $this->checkable;
// // }
//
// $obj = json_encode($categories);
} | Class | 2 |
foreach ($project_templates as $project_template) {
if ((int) $project_template->getGroupId() === \Project::ADMIN_PROJECT_ID) {
continue;
}
$company_templates[] = new CompanyTemplate($project_template, $this->glyph_finder);
} | Class | 2 |
public function show()
{
$task = $this->getTask();
$subtask = $this->getSubtask();
$this->response->html($this->template->render('subtask_restriction/show', array(
'status_list' => array(
SubtaskModel::STATUS_TODO => t('Todo'),
SubtaskModel::STATUS_DONE => t('Done'),
),
'subtask_inprogress' => $this->subtaskStatusModel->getSubtaskInProgress($this->userSession->getId()),
'subtask' => $subtask,
'task' => $task,
)));
} | Base | 1 |
public function showall() {
expHistory::set('viewable', $this->params);
// figure out if should limit the results
if (isset($this->params['limit'])) {
$limit = $this->params['limit'] == 'none' ? null : $this->params['limit'];
} else {
$limit = (isset($this->config['limit']) && $this->config['limit'] != '') ? $this->config['limit'] : 10;
}
$order = isset($this->config['order']) ? $this->config['order'] : 'publish DESC';
// pull the news posts from the database
$items = $this->news->find('all', $this->aggregateWhereClause(), $order);
// merge in any RSS news and perform the sort and limit the number of posts we return to the configured amount.
if (!empty($this->config['pull_rss'])) $items = $this->mergeRssData($items);
// setup the pagination object to paginate the news stories.
$page = new expPaginator(array(
'records'=>$items,
'limit'=>$limit,
'order'=>$order,
'page'=>(isset($this->params['page']) ? $this->params['page'] : 1),
'controller'=>$this->params['controller'],
'action'=>$this->params['action'],
'src'=>$this->loc->src,
'view'=>empty($this->params['view']) ? null : $this->params['view']
));
assign_to_template(array(
'page'=>$page,
'items'=>$page->records,
'rank'=>($order==='rank')?1:0,
'params'=>$this->params,
));
} | Base | 1 |
public function buildControl() {
$control = new colorcontrol();
if (!empty($this->params['value'])) $control->value = $this->params['value'];
if ($this->params['value'][0] != '#') $this->params['value'] = '#' . $this->params['value'];
$control->default = $this->params['value'];
if (!empty($this->params['hide'])) $control->hide = $this->params['hide'];
if (isset($this->params['flip'])) $control->flip = $this->params['flip'];
$this->params['name'] = !empty($this->params['name']) ? $this->params['name'] : '';
$control->name = $this->params['name'];
$this->params['id'] = !empty($this->params['id']) ? $this->params['id'] : '';
$control->id = isset($this->params['id']) && $this->params['id'] != "" ? $this->params['id'] : "";
//echo $control->id;
if (empty($control->id)) $control->id = $this->params['name'];
if (empty($control->name)) $control->name = $this->params['id'];
// attempt to translate the label
if (!empty($this->params['label'])) {
$this->params['label'] = gt($this->params['label']);
} else {
$this->params['label'] = null;
}
echo $control->toHTML($this->params['label'], $this->params['name']);
// $ar = new expAjaxReply(200, gt('The control was created'), json_encode(array('data'=>$code)));
// $ar->send();
}
| Base | 1 |
public function update_groupdiscounts() {
global $db;
if (empty($this->params['id'])) {
// look for existing discounts for the same group
$existing_id = $db->selectValue('groupdiscounts', 'id', 'group_id='.$this->params['group_id']);
if (!empty($existing_id)) flashAndFlow('error',gt('There is already a discount for that group.'));
}
$gd = new groupdiscounts();
$gd->update($this->params);
expHistory::back();
} | Base | 1 |
public function testGetEvents(){
TestingAuxLib::loadX2NonWebUser ();
TestingAuxLib::suLogin ('admin');
Yii::app()->settings->historyPrivacy = null;
$lastEventId = 0;
$lastTimestamp = 0;
$events = Events::getEvents ($lastEventId, $lastTimestamp, 4);
$this->assertEquals (
Yii::app()->db->createCommand (
"select id from x2_events order by timestamp desc, id desc limit 4")
->queryColumn (),
array_map(function ($event) { return $event->id; }, $events['events'])
);
TestingAuxLib::restoreX2WebUser ();
} | Base | 1 |
function GenerateCryptKey($size = "", $secure = false, $numerals = false, $capitalize = false, $ambiguous = false, $symbols = false)
{
// load library
$pwgen = new SplClassLoader('Encryption\PwGen', '../includes/libraries');
$pwgen->register();
$pwgen = new Encryption\PwGen\pwgen();
// init
if (!empty($size)) {
$pwgen->setLength($size);
}
if (!empty($secure)) {
$pwgen->setSecure($secure);
}
if (!empty($numerals)) {
$pwgen->setNumerals($numerals);
}
if (!empty($capitalize)) {
$pwgen->setCapitalize($capitalize);
}
if (!empty($ambiguous)) {
$pwgen->setAmbiguous($ambiguous);
}
if (!empty($symbols)) {
$pwgen->setSymbols($symbols);
}
// generate and send back
return $pwgen->generate();
} | Base | 1 |
$class = $container->getParameterBag()->resolveValue($def->getClass());
$refClass = new \ReflectionClass($class);
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
if (!$refClass->implementsInterface($interface)) {
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
}
$definition->addMethodCall('addSubscriberService', array($id, $class));
} | Base | 1 |
public function approve_toggle() {
global $history;
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']) ? 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'];
$simplenote = new expSimpleNote($this->params['id']);
$simplenote->approved = $simplenote->approved == 1 ? 0 : 1;
$simplenote->save();
$lastUrl = makelink($history->history[$history->history['lasts']['type']][count($history->history[$history->history['lasts']['type']])-1]['params']);
if (!empty($this->params['tab']))
{
$lastUrl .= "#".$this->params['tab'];
}
redirect_to($lastUrl);
} | Class | 2 |
return $fa->nameGlyph($icons, 'icon-');
}
} else {
return array();
}
}
| Base | 1 |
public function testNewInstanceWhenNewProtocol()
{
$r = new Response(200);
$this->assertNotSame($r, $r->withProtocolVersion('1.0'));
} | Base | 1 |
function edit() {
if (empty($this->params['content_id'])) {
flash('message',gt('An error occurred: No content id set.'));
expHistory::back();
}
/* The global constants can be overridden by passing appropriate params */
//sure wish I could do this once in the constructor. sadly $this->params[] isn't set yet
// $require_login = empty($this->params['require_login']) ? COMMENTS_REQUIRE_LOGIN : $this->params['require_login'];
// $require_approval = empty($this->params['require_approval']) ? COMMENTS_REQUIRE_APPROVAL : $this->params['require_approval'];
// $require_notification = empty($this->params['require_notification']) ? COMMENTS_REQUIRE_NOTIFICATION : $this->params['require_notification'];
// $notification_email = empty($this->params['notification_email']) ? COMMENTS_NOTIFICATION_EMAIL : $this->params['notification_email'];
$id = empty($this->params['id']) ? null : $this->params['id'];
$comment = new expComment($id);
//FIXME here is where we might sanitize the comment before displaying/editing it
assign_to_template(array(
'content_id'=>$this->params['content_id'],
'content_type'=>$this->params['content_type'],
'comment'=>$comment
));
} | Base | 1 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
if (! empty($action) && $this->actionModel->remove($action['id'])) {
$this->flash->success(t('Action removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this action.'));
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
static function description() {
return gt("This module is for managing categories in your store.");
} | Base | 1 |
public function __toString()
{
$str = $this->data['Name'] . '=' . $this->data['Value'] . '; ';
foreach ($this->data as $k => $v) {
if ($k != 'Name' && $k != 'Value' && $v !== null && $v !== false) {
if ($k == 'Expires') {
$str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; ';
} else {
$str .= ($v === true ? $k : "{$k}={$v}") . '; ';
}
}
}
return rtrim($str, '; ');
} | 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 |
static public function getInstanceOf($_usernfo, $_tid) {
if (!isset(self::$tickets[$_tid])) {
self::$tickets[$_tid] = new ticket($_usernfo, $_tid);
}
return self::$tickets[$_tid];
} | Class | 2 |
public static function canView($section) {
global $db;
if ($section == null) {
return false;
}
if ($section->public == 0) {
// Not a public section. Check permissions.
return expPermissions::check('view', expCore::makeLocation('navigation', '', $section->id));
} else { // Is public. check parents.
if ($section->parent <= 0) {
// Out of parents, and since we are still checking, we haven't hit a private section.
return true;
} else {
$s = $db->selectObject('section', 'id=' . $section->parent);
return self::canView($s);
}
}
}
| Base | 1 |
public function confirm()
{
$task = $this->getTask();
$link = $this->getTaskLink();
$this->response->html($this->template->render('task_internal_link/remove', array(
'link' => $link,
'task' => $task,
)));
} | Base | 1 |
function generateAutoLoginLink($params){
$dataRequest = array();
$dataRequestAppend = array();
// Destination ID
if (isset($params['r'])){
$dataRequest['r'] = $params['r'];
$dataRequestAppend[] = '/(r)/'.rawurlencode(base64_encode($params['r']));
}
// User ID
if (isset($params['u']) && is_numeric($params['u'])){
$dataRequest['u'] = $params['u'];
$dataRequestAppend[] = '/(u)/'.rawurlencode($params['u']);
}
// Username
if (isset($params['l'])){
$dataRequest['l'] = $params['l'];
$dataRequestAppend[] = '/(l)/'.rawurlencode($params['l']);
}
if (!isset($params['l']) && !isset($params['u'])) {
throw new Exception('Username or User ID has to be provided');
}
$ts = time() + $params['t'];
// Expire time for link
if (isset($params['t'])) {
$dataRequest['t'] = $ts;
$dataRequestAppend[] = '/(t)/'.rawurlencode($ts);
}
$hashValidation = sha1($params['secret_hash'].sha1($params['secret_hash'].implode(',', $dataRequest)));
return $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect("user/autologin") . "/{$hashValidation}".implode('', $dataRequestAppend);
} | Class | 2 |
public function remove()
{
$this->checkCSRFParam();
$project = $this->getProject();
$action = $this->actionModel->getById($this->request->getIntegerParam('action_id'));
if (! empty($action) && $this->actionModel->remove($action['id'])) {
$this->flash->success(t('Action removed successfully.'));
} else {
$this->flash->failure(t('Unable to remove this action.'));
}
$this->response->redirect($this->helper->url->to('ActionController', 'index', array('project_id' => $project['id'])));
} | Base | 1 |
public function testSettingCookie()
{
$_SERVER['REQUEST_METHOD'] = 'GET';
$controller = $this->getMock('Cake\Controller\Controller', ['redirect']);
$controller->request = new Request(['webroot' => '/dir/']);
$controller->response = new Response();
$event = new Event('Controller.startup', $controller);
$this->component->startup($event);
$cookie = $controller->response->cookie('csrfToken');
$this->assertNotEmpty($cookie, 'Should set a token.');
$this->assertRegExp('/^[a-f0-9]+$/', $cookie['value'], 'Should look like a hash.');
$this->assertEquals(0, $cookie['expire'], 'session duration.');
$this->assertEquals('/dir/', $cookie['path'], 'session path.');
$this->assertEquals($cookie['value'], $controller->request->params['_csrfToken']);
} | Compound | 4 |
public function getOnClickAction() {
return 'javascript:openNewGal(\''.$this->stack_name.'\');';
} | Base | 1 |
private static function sesKey() {
$ip = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];
$dt = date("Y-m-d H");
$key = md5($ip.$browser.$dt);
return $key;
}
| Base | 1 |
public function __construct() {
if (System::existConf()) {
new System();
}else{
$this->install();
}
}
| Base | 1 |
private function _notlastmodifiedby( $option ) {
$user = new \User;
$this->addWhere( $this->DB->addQuotes( $user->newFromName( $option )->getActorId() ) . ' != (SELECT revactor_actor FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id ORDER BY ' . $this->tableNames['revision_actor_temp'] . '.revactor_timestamp DESC LIMIT 1)' );
} | Class | 2 |
public function skip($value)
{
return $this->offset($value);
} | Base | 1 |
public function getItems2 (
$prefix='', $page=0, $limit=20, $valueAttr='name', $nameAttr='name') {
$modelClass = get_class ($this->owner);
$model = CActiveRecord::model ($modelClass);
$table = $model->tableName ();
$offset = intval ($page) * intval ($limit);
AuxLib::coerceToArray ($valueAttr);
$modelClass::checkThrowAttrError (array_merge ($valueAttr, array ($nameAttr)));
$params = array ();
if ($prefix !== '') {
$params[':prefix'] = $prefix . '%';
}
$offset = abs ((int) $offset);
$limit = abs ((int) $limit);
$command = Yii::app()->db->createCommand ("
SELECT " . implode (',', $valueAttr) . ", $nameAttr as __name
FROM $table
WHERE " . ($prefix === '' ?
'1=1' : ($nameAttr . ' LIKE :prefix')
) . "
ORDER BY __name
LIMIT $offset, $limit
"); | Base | 1 |
function reset_stats() {
// global $db;
// reset the counters
// $db->sql ('UPDATE '.$db->prefix.'banner SET impressions=0 WHERE 1');
banner::resetImpressions();
// $db->sql ('UPDATE '.$db->prefix.'banner SET clicks=0 WHERE 1');
banner::resetClicks();
// let the user know we did stuff.
flash('message', gt("Banner statistics reset."));
expHistory::back();
} | Class | 2 |
public function testNewInstanceWhenRemovingHeader()
{
$r = new Response(200, ['Foo' => 'Bar']);
$r2 = $r->withoutHeader('Foo');
$this->assertNotSame($r, $r2);
$this->assertFalse($r2->hasHeader('foo'));
} | 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,
));
} | Class | 2 |
static function isSearchable() { return true; }
| 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 |
public function getRawRevisionsAndCount($limit, PFUser $author)
{
return svn_get_revisions(
$this->project,
0,
$limit,
'',
$author->getUserName(),
'',
'',
0,
false
);
} | Base | 1 |
public function getFilePath($fileName = null)
{
if ($fileName === null) {
$fileName = $this->fileName;
}
return $this->theme->getPath().'/'.$this->dirName.'/'.$fileName;
} | Base | 1 |
public function rules()
{
$ignore = Rule::unique('users')->ignore($this->id ?? 0, 'id');
return [
'email' => [
$ignore,
],
'username' => [
$ignore,
],
];
} | Base | 1 |
function edit_internalalias() {
$section = isset($this->params['id']) ? $this->section->find($this->params['id']) : new section($this->params);
if ($section->parent == -1) {
notfoundController::handle_not_found();
exit;
} // doesn't work for standalone pages
if (empty($section->id)) {
$section->public = 1;
if (!isset($section->parent)) {
// This is another precaution. The parent attribute
// should ALWAYS be set by the caller.
//FJD - if that's the case, then we should die.
notfoundController::handle_not_authorized();
exit;
//$section->parent = 0;
}
}
assign_to_template(array(
'section' => $section,
'glyphs' => self::get_glyphs(),
));
}
| Base | 1 |
foreach ($elem[2] as $field) {
echo '
<tr class="tr_cf tr_fields hidden" id="cf_tr_'.$field[0].'">
<td valign="top" class="td_title"> <i class="fa fa-caret-right"></i> <i>'.$field[1].'</i> :</td>
<td>';
if ($field[3] === "masked") {
echo '
<div id="id_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" style="float:left; cursor:pointer; width:300px;" class="fields_div unhide_masked_data pointer"></div><input type="hidden" id="hid_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" class="fields" />';
} else {
echo '
<div id="id_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" style="display:inline;" class="fields_div"></div><input type="hidden" id="hid_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" class="fields" />';
}
echo '
</td>
</tr>';
} | Class | 2 |
protected function _setContent($path, $fp) {
rewind($fp);
$fstat = fstat($fp);
$size = $fstat['size'];
} | Base | 1 |
public function scopeSearch(Builder $query, array $search = [])
{
if (empty($search)) {
return $query;
}
if (!array_intersect(array_keys($search), $this->searchable)) {
return $query;
}
return $query->where($search);
} | Class | 2 |
function VerifyVariableSchedule_Update($columns)
{
// $teacher=$columns['TEACHER_ID'];
// $secteacher=$columns['SECONDARY_TEACHER_ID'];
// if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')
// {
// $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');
// }
// else
// //$all_teacher=($secteacher!=''?$secteacher:'');
// $all_teacher=$teacher.($secteacher!=''?','.$secteacher:'');
$teacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']:$columns['TEACHER_ID']);
$secteacher=($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']!=''?$_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['SECONDARY_TEACHER_ID']:$columns['SECONDARY_TEACHER_ID']);
// $secteacher=$qr_teachers[1]['SECONDARY_TEACHER_ID'];
if($_REQUEST['tables']['course_periods'][$_REQUEST['course_period_id']]['TEACHER_ID']!='')
$all_teacher=$teacher.($secteacher!=''?','.$secteacher:''); | Base | 1 |
public function create_file() {
if (!AuthUser::hasPermission('file_manager_mkfile')) {
Flash::set('error', __('You do not have sufficient permissions to create 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/create_file')) {
Flash::set('error', __('Invalid CSRF token found!'));
redirect(get_url('plugin/file_manager/browse/'));
}
}
else {
Flash::set('error', __('No CSRF token found!'));
redirect(get_url('plugin/file_manager/browse/'));
}
$data = $_POST['file'];
$path = str_replace('..', '', $data['path']);
$filename = str_replace('..', '', $data['name']);
$file = FILES_DIR . DS . $path . DS . $filename;
if (file_put_contents($file, '') !== false) {
$mode = Plugin::getSetting('filemode', 'file_manager');
chmod($file, octdec($mode));
} else {
Flash::set('error', __('File :name has not been created!', array(':name' => $filename)));
}
redirect(get_url('plugin/file_manager/browse/' . $path));
} | Class | 2 |
$t = preg_split('/[ \t]/', trim($enclosure[2]) );
$type = $t[0];
/**
* Filters the RSS enclosure HTML link tag for the current post.
*
* @since 2.2.0
*
* @param string $html_link_tag The HTML link tag with a URI and other attributes.
*/
echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" length="' . trim( $enclosure[1] ) . '" type="' . $type . '" />' . "\n" );
}
}
} | Base | 1 |
public static function remove($token){
$json = Options::v('tokens');
$tokens = json_decode($json, true);
unset($tokens[$token]);
$tokens = json_encode($tokens);
if(Options::update('tokens',$tokens)){
return true;
}else{
return false;
}
}
| Base | 1 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.