当前位置: 首页>>代码示例>>PHP>>正文


PHP Flash::create方法代码示例

本文整理汇总了PHP中Flash::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Flash::create方法的具体用法?PHP Flash::create怎么用?PHP Flash::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Flash的用法示例。


在下文中一共展示了Flash::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 function run()
 {
     global $SITE, $DB, $Templates;
     $_POST->setType('vis', 'any', true);
     $_POST->setType('def', 'string', true);
     $_REQUEST->setType('upd', 'any');
     $properties = $DB->setset->asArray(false, false, false, false, 'property');
     if ($_POST['def']) {
         $vis = $_POST['vis'];
         $def = $_POST['def'];
         foreach ($properties as $property) {
             $property = $property['property'];
             Settings::changeSetting($property, false, false, $vis[$property]);
             $SITE->settings[$property] = $def[$property];
         }
         redirect(url(array('upd' => 1), true));
     }
     if ($_REQUEST['upd']) {
         Flash::create(__('Settings updated'), 'confirmation');
     }
     __autoload('Form');
     $TRs = array();
     $settings_types = array(__('Administrator-specified'), __('User level, pre-specified'), __('User level, self-specified'), __('User- or group level, pre-specified'), __('User- or group level , self-specified'), __('Group level, pre-specified'), __('Group level, self-specified'));
     foreach ($properties as $property) {
         $TRs[] = new Tablerow(Settings::name($property['property']), new Select(false, 'vis[' . $property['property'] . ']', $settings_types, $property['visible']), Settings::display($property['type'], false, 'def[' . $property['property'] . ']', $SITE->settings[$property['property']], $property['description'], $property['set']));
     }
     $form = new Form('sitesettings');
     $this->setContent('header', __('Default user settings'));
     $this->setContent('main', $form->collection(new Table(new Tableheader(__('Property'), __('Type'), __('Property default')), $TRs)));
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:31,代码来源:UserSettings.php

示例2: run

 /**
  * In this function, most actions of the module are carried out and the page generation is started, distibuted and rendered.
  * @return void
  * @see solidbase/lib/Page#run()
  */
 function run()
 {
     global $Templates, $USER, $CONFIG, $Controller, $DB;
     if (!$this->may($USER, READ | EDIT)) {
         errorPage('401');
         return false;
     }
     /**
      * User input types
      */
     $_REQUEST->setType('order', 'numeric', true);
     $_REQUEST->setType('expand', 'bool');
     $_REQUEST->setType('del', 'numeric');
     if ($_REQUEST['del']) {
         if ($Controller->{$_REQUEST['del']} && $Controller->{$_REQUEST['del']}->delete()) {
             Flash::create(__('Newsitem removed'), 'confirmation');
         }
     }
     /**
      * Here, the page request and permissions decide what should be shown to the user
      */
     $this->setContent('header', __('News'));
     $this->setContent('main', $this->mainView());
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:30,代码来源:NewsAdmin.php

示例3: run

    function run()
    {
        global $Templates, $CONFIG, $DB, $Controller;
        $_REQUEST->setType('flash', 'any');
        if ($_REQUEST->valid('flash')) {
            Flash::create($_REQUEST['flash'] . '_flash_1', $_REQUEST['flash']);
        }
        $_REQUEST->setType('addToConfig', 'any');
        if ($_REQUEST->valid('addToConfig')) {
            $CONFIG->Frontpage->setType('NewsItems', 'text');
            $CONFIG->Frontpage->setDescription('NewsItems', 'Number of news items displayed');
            $CONFIG->Frontpage->NewsItems = 5;
        }
        $content = '';
        $newsNum = $CONFIG->Frontpage->NewsItems;
        if (!is_numeric($newsNum) || $newsNum < 1 || $newsNum > 30) {
            $newsNum = 5;
        }
        $newsNum = 3;
        /* Retrive news objects */
        if ($newsNum > 0) {
            $newsObj = Flow::retrieve('News', $newsNum, false, false, false, 0, true);
        }
        /* <<< New flowing design >>> */
        foreach ($newsObj as $news) {
            $content .= $news->display('new');
        }
        $mlForm = new Form('mailListForm');
        $ml = $mlForm->quick(null, __('Send'), new Input('Email', 'mlmail'));
        $r = '<div id="intro">
        	<div class="lcol"><img src="' . $Templates->current->webdir . 'images/intro/IMG_0817.jpg" width="400" alt="Lihkoren" /></div>
	        <div class="rcol"><p>Link&ouml;pings Students&aring;ngarf&ouml;rening Lihk&ouml;ren &auml;r en mansk&ouml;r som verkar vid Link&ouml;pings universitet, under ledning av director musices Hans Lundgren. K&ouml;ren bildades 1972 av studenter vid d&aring;varande Link&ouml;pings H&ouml;gskola.
Lihk&ouml;ren uttalas som det smakar. K&ouml;ren framf&ouml;r fr&auml;mst nordisk och europeisk musik, delvis fr&aring;n den traditionella mansk&ouml;rsrepertoaren men &auml;ven nyskriven musik. Glimten i &ouml;gat och den goda kontakten med publiken pr&auml;glar konserterna.<br>V&auml;l m&ouml;tt.</p></div>
			<img src="' . $Templates->current->webdir . 'images/rand_top.png" alt="pagesplit" class="pagesplit" />
		</div>
		<div id="fbottom">
			<div class="lcol">
				<div class="lbox coming"><h1 class="icn-hdr"><span class="icn icn-coming"></span>' . __('Kommande h&auml;ndelser') . '</h1>
					<p>Kommande h&auml;ndelser i kalendern.</p>
				</div>
				<div class="lbox maillist"><h1 class="icn-hdr"><span class="icn icn-mail"></span>' . __('Nyhetsbrev') . '</h1>
					<p class="pre">Vill du f&aring; information om kommande konserter och andra arrangemang med Lihk&ouml;ren?</p>
					' . $ml . '
					<p>Du kommer d&aring; att f&aring; ett e-brev som du m&aring;ste svara p&aring; f&ouml;r att bekr&auml;fta att du vill att informationen ska skickas till dig</p>
				</div>
			</div>
        	<div class="rbox news"><h1 class="icn-hdr"><span class="icn icn-news"></span>' . __('Nyheter') . '</h1>' . $content . '<a href="/flowView?q=News">' . __('View all news') . '</a></div>
        </div>';
        /*         dump($Templates->current->webdir); */
        $this->setContent('main', $r);
        $Templates->render();
    }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:52,代码来源:Frontpage.php

示例4: saveChanges

 function saveChanges()
 {
     $_REQUEST->setType('oldname', 'string');
     $_REQUEST->setType('newname', 'string');
     if ($_REQUEST['oldname'] && $_REQUEST['newname']) {
         if ($obj = $Controller->{$_REQUEST['oldname']}('MenuSection')) {
             if ($DB->aliases->exists(array('alias' => $_REQUEST['newname'], 'id!' => $obj->ID))) {
                 Flash::create(__('Alias already in use'));
             } else {
                 $obj->resetAlias($_REQUEST['newname']);
                 $obj->template = $_REQUEST['template'];
                 Flash::create(__('Section edited'), 'confirmation');
             }
         }
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:16,代码来源:MenuSectionEditor.php

示例5: run

 /**
  * Contains actions and page view handling
  * @return void
  * @see solidbase/lib/Page#run()
  */
 function run()
 {
     global $Templates, $USER, $DB, $CONFIG;
     /**
      * User input types
      */
     $_REQUEST->setType('conf', 'string', true);
     if (!$this->may($USER, ANYTHING)) {
         errorPage(401);
     }
     if ($this->may($USER, EDIT)) {
         if ($_REQUEST['conf']) {
             $r = $DB->config->get(null, null, null, 'section,property');
             while ($c = Database::fetchAssoc($r)) {
                 $val = @$_REQUEST['conf'][$c['section']][$c['property']];
                 switch ($c['type']) {
                     case 'CSV':
                         $val = @explode(',', $val);
                     case 'password':
                         if ($c['type'] == 'password' && $val == '********') {
                             continue 2;
                         }
                     case 'select':
                     case 'set':
                     case 'text':
                         if ($val === false) {
                             continue;
                         }
                         $CONFIG->{$c['section']}->{$c['property']} = $val;
                         break;
                     case 'check':
                         $CONFIG->{$c['section']}->{$c['property']} = (int) isset($val);
                         break;
                 }
             }
             Log::write('Configuration changed', 2);
             Flash::create(__('The configuration was updated'), 'confirmation');
         }
     }
     $this->setContent('header', 'Edit configuration');
     $this->setContent('main', $this->viewAll());
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:48,代码来源:ConfigEditor.php

示例6: run

 function run()
 {
     global $DB, $Templates;
     if (!$this->mayI(READ)) {
         errorPage(401);
     }
     $_REQUEST->setType('delsd', 'string');
     $_REQUEST->setType('editsd', 'string');
     $_POST->setType('sdname', 'string');
     $_POST->setType('sdassoc', 'string');
     if ($_POST['sdname']) {
         if ($_REQUEST['editsd']) {
             if ($DB->subdomains->update(array('subdomain' => $_POST['sdname'], 'assoc' => $_POST['sdassoc']), array('subdomain' => $_REQUEST['editsd']))) {
                 Flash::create(__('Subdomain updated'), 'confirmation');
             } else {
                 Flash::create(__('Subdomain in use'), 'warning');
             }
         } else {
             if ($DB->subdomains->insert(array('subdomain' => $_POST['sdname'], 'assoc' => $_POST['sdassoc']))) {
                 Flash::create(__('New subdomain inserted'), 'confirmation');
             } else {
                 Flash::create(__('Subdomain in use'), 'warning');
             }
         }
     } elseif ($_REQUEST['delsd'] && $this->mayI(EDIT)) {
         $DB->subdomains->delete(array('subdomain' => $_REQUEST['delsd']));
     }
     $r = $DB->subdomains->get(false, false, false, 'subdomain');
     $tablerows = array();
     while (false !== ($subdomain = Database::fetchAssoc($r))) {
         $tablerows[] = new Tablerow($subdomain['subdomain'], $subdomain['assoc'], icon('small/delete', __('Delete subdomain'), url(array('delsd' => $subdomain['subdomain']), 'id')) . icon('small/pencil', __('Edit subdomain'), url(array('editsd' => $subdomain['subdomain']), 'id')));
     }
     if ($_REQUEST['editsd']) {
         $sd = $DB->subdomains->getRow(array('subdomain' => $_REQUEST['editsd']));
         $form = new Form('editSubdomain');
     } else {
         $sd = false;
         $form = new Form('newSubdomain');
     }
     $this->setContent('main', (!empty($tablerows) ? new Table(new Tableheader(__('Subdomain'), __('Associated with..'), __('Actions')), $tablerows) : '') . $form->set($_REQUEST['editsd'] ? new Hidden('editsd', $_REQUEST['editsd']) : null, new input(__('Subdomain'), 'sdname', @$sd['subdomain']), new input(__('Associate with'), 'sdassoc', @$sd['assoc'], false, __('ID or alias to associate with the subdomain'))));
     $Templates->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:42,代码来源:Subdomains.php

示例7: saveChanges

 function saveChanges()
 {
     $_POST->setType('etitle', 'string');
     $_POST->setType('etxt', 'string');
     $_POST->setType('estart', 'any');
     $_POST->setType('eend', 'any');
     if (!$_POST['etitle']) {
         Flash::create(__('Please enter a title'));
         return;
     }
     if (!$_POST['etxt']) {
         Flash::create(__('Please enter a text'));
         return;
     }
     $this->that->Name = $_POST['etitle'];
     $this->that->Image = $_POST['eimg'];
     $this->that->setActive(Short::parseDateAndTime('estart'), Short::parseDateAndTime('eend', false));
     $this->that->saveContent(array('Text' => $_POST['etxt']));
     $Controller->forceReload($this->that);
     Flash::create(__('Your data was saved'), 'confirmation');
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:21,代码来源:NewsEditor.php

示例8: tryImportLDAP

 private function tryImportLDAP($username, $password)
 {
     global $CONFIG, $DB, $Controller;
     $ldapconn = ldap_connect($CONFIG->LDAP->bindurl);
     if (!(strstr($username, '*') === false)) {
         //Don't search for wildcards
         Flash::create(__('Ajabaja!'), 'warning');
         return false;
     }
     if ($ldapconn) {
         // Bind (log in) to LDAP server
         if (ldap_bind($ldapconn, $CONFIG->LDAP->binddn, $CONFIG->LDAP->bindpw)) {
             //echo "LDAP bind successful...<br />\n";
             $unameattr = $CONFIG->LDAP->unameattr;
             if (@empty($unameattr)) {
                 $unameattr = 'cn';
             }
             $storeattrs = $CONFIG->LDAP->storeattrs;
             if (@empty($storeattrs)) {
                 // Not configured properly
                 return false;
             }
             $filter = '(' . $unameattr . '=' . $username . ')';
             $search = ldap_search($ldapconn, $CONFIG->LDAP->basedn, $filter, $storeattrs, 0, 1);
             // The last parameter is to limit search to 1 result returned
             if ($search) {
                 // Found user
                 $entry = @ldap_first_entry($ldapconn, $search);
                 // Get DN from search result
                 $dn = @ldap_get_dn($ldapconn, $entry);
                 if (!$dn) {
                     return false;
                 }
                 //echo 'Found ' . $dn . "\n";
                 // LiU programregistrering
                 // FIXME: $CONFIG
                 $filterattr = 'liuStudentProgramCode';
                 // Y-programregistrering
                 // FIXME: $CONFIG
                 $filterregexp = '/^[6t]cyy[yi]-[1-9]-[vh]t20[01][0-9]$/';
                 $attrs = @ldap_get_attributes($ldapconn, $entry);
                 $user_ok = false;
                 $userdata = array();
                 for ($i = 0; $i < $attrs['count']; $i++) {
                     $attr_name = $attrs[$i];
                     for ($j = 0; $j < $attrs[$attr_name]['count']; $j++) {
                         if ($attr_name == $filterattr) {
                             if (preg_match($filterregexp, $attrs[$attr_name][$j])) {
                                 // User is okay to log in even though admin hasn't imported them from LDAP
                                 $user_ok = true;
                             }
                         }
                         if (isset($userdata[$attr_name])) {
                             if ($this->compareLDAP($attr_name, $userdata[$attr_name], $attrs[$attr_name][$j]) < 0) {
                                 $userdata[$attr_name] = $attrs[$attr_name][$j];
                             }
                         } else {
                             $userdata[$attr_name] = $attrs[$attr_name][$j];
                         }
                     }
                 }
                 if (!$user_ok) {
                     // User does not match the regexp, won't be allowed to log in.
                     return false;
                 }
                 if (!array_key_exists($unameattr, $userdata) || !$userdata[$unameattr]) {
                     dump($userdata);
                     Flash::create(__('No username attribute value for: ') . $dn . ' unameattr: ' . $unameattr, 'warning');
                     return false;
                 }
                 // Don't unbind.
                 /* http://php.net/manual/en/function.ldap-unbind.php
                  *  kmenard at wpi dot edu
                  * 29-Nov-2001 07:47
                  * ldap_unbind kills the link descriptor.  So, if you want to rebind
                  * as another user, just bind again; don't unbind.
                  * Otherwise, you'll have to open up a new connection.
                  */
                 // Try to bind as the user account
                 // @ to not print a big error message if the user entered the wrong password
                 if (@ldap_bind($ldapconn, $dn, $password)) {
                     regenerateSession(true);
                     //echo 'Login successful';
                     $username = $userdata[$unameattr];
                     if ($DB->users->exists(array('username' => $username))) {
                         // This can actually happen through a race condition if the same user tries to log in twice in parallel.
                         Flash::create(__('BUG: Username already in use, try logging in again: ') . $username, 'warning');
                         return false;
                     }
                     Flash::create(__('Adding user: ') . $username, 'confirmation');
                     if ($user = $Controller->newObj('User')) {
                         $user->username = $username;
                         $user->passwordhash = 'LDAP';
                         Log::write('Imported user \'' . $username . '\' (id=' . $user->ID . ') from LDAP through autoimport', 20);
                         foreach ($userdata as $attr => $value) {
                             if ($attr == $unameattr || $attr == 'userPassword') {
                                 continue;
                             }
                             $user->userinfo = array($attr => $value);
                         }
//.........这里部分代码省略.........
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:101,代码来源:User.php

示例9: run

 /**
  * In this function, most actions of the module are carried out and the page generation is started, distibuted and rendered.
  * @return void
  * @see solidbase/lib/Page#run()
  */
 function run()
 {
     global $Templates, $USER, $CONFIG, $Controller, $DB;
     if (!$this->may($USER, READ | EDIT)) {
         errorPage('401');
         return false;
     }
     /**
      * User input types
      */
     $_REQUEST->setType('asave', 'any');
     $_REQUEST->setType('view', 'string');
     $_REQUEST->setType('edit', array('numeric', '#new#'));
     $_REQUEST->setType('del', 'numeric');
     $_REQUEST->setType('lang', 'string');
     $_POST->setType('atitle', 'string');
     $_POST->setType('apubd', 'string');
     $_POST->setType('apubt', 'string');
     $_POST->setType('atxt', 'any');
     $_POST->setType('apre', 'any');
     if ($_REQUEST['del']) {
         if ($Controller->{$_REQUEST['del']} && $Controller->{$_REQUEST['del']}->delete()) {
             Flash::create(__('Article removed'), 'confirmation');
         }
     }
     /**
      * Save newsitem
      */
     do {
         $item = false;
         if ($_REQUEST['edit'] && $_REQUEST['asave']) {
             if (is_numeric($_REQUEST['edit'])) {
                 $item = new Article($_REQUEST['edit'], $_REQUEST['lang']);
                 if (!$item || !is_a($item, 'Article') || !$item->mayI(EDIT)) {
                     Flash::create(__('Invalid article'), 'warning');
                     break;
                 }
             }
             if (!$_POST['atitle']) {
                 Flash::create(__('Please enter a title'));
                 break;
             }
             if (!$_POST['atxt']) {
                 Flash::create(__('Please enter a text'));
                 break;
             }
             if ($_REQUEST['edit'] === 'new') {
                 $item = $Controller->newObj('Article', $_REQUEST['lang']);
                 $_REQUEST['edit'] = $item->ID;
             }
             if ($item) {
                 $item->Name = $_POST['atitle'];
                 $item->Publish = strtotime($_POST['apubd'] . ', ' . $_POST['apubt']);
                 $item->saveContent(array('Preamble' => $_POST['apre'], 'Text' => $_POST['atxt']));
                 Flash::create(__('Your data was saved'), 'confirmation');
                 $_REQUEST->clear('edit');
                 $_POST->clear('atitle', 'apubd', 'apubt', 'atxt', 'apre');
             } else {
                 Flash::create(__('Unexpected error'), 'warning');
                 break;
             }
         }
     } while (false);
     /**
      * Here, the page request and permissions decide what should be shown to the user
      */
     if (is_numeric($_REQUEST['edit'])) {
         $this->editView($_REQUEST['edit'], $_REQUEST['lang']);
     } else {
         $this->content = array('header' => __('Articles'), 'main' => $this->mainView());
     }
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:78,代码来源:Articles.php

示例10: run

 function run()
 {
     global $Templates, $USER, $Controller, $DB, $CONFIG;
     if (!$this->may($USER, ANYTHING)) {
         errorPage('401');
     }
     /**
      * Company input types
      */
     $_REQUEST->setType('edit', array('numeric', '#^new$#'));
     $_REQUEST->setType('newCompanySubm', 'any');
     $_REQUEST->setType('updCompanySubm', 'any');
     $_REQUEST->setType('delCompany', 'numeric');
     $_REQUEST->setType('compid', 'numeric');
     $_REQUEST->setType('name', 'string');
     $_REQUEST->setType('logo', 'string');
     $_REQUEST->setType('url', 'string');
     $_REQUEST->setType('redirect', 'any');
     $_REQUEST->setType('weight', 'numeric');
     $_REQUEST->setType('type', '#^(main|sub)$#');
     $_REQUEST->setType('madd', 'numeric');
     /**
      * Add a new company
      */
     if ($this->may($USER, EDIT) && $_REQUEST['newCompanySubm']) {
         if (!$DB->companies->exists(array('name' => $_REQUEST['name'])) && $_REQUEST->nonempty('name')) {
             $comp = $Controller->newObj('Company');
             $DB->companies->insert(array('id' => $comp->ID));
             $comp->Name = $_REQUEST['name'];
             $comp->logo = $_REQUEST['logo'];
             $comp->URL = $_REQUEST['url'];
             if (isset($_REQUEST['redirect'])) {
                 $comp->redirect = 1;
             } else {
                 $comp->redirect = 0;
             }
             $comp->weight = $_REQUEST['weight'];
             $comp->type = $_REQUEST['type'];
             Flash::create(__('New company was registered'), 'confirmation');
             /* 				Log::write('New company created'); */
         } else {
             Flash::create(__('A Company with that name already exists'), 'warning');
         }
     } elseif ($this->may($USER, EDIT) && $_REQUEST['updCompanySubm'] && $Controller->{$_REQUEST['compid']}('Company') !== false) {
         $comp = $Controller->{$_REQUEST['compid']}(OVERRIDE);
         if ($_REQUEST->valid('name')) {
             $comp->Name = $_REQUEST['name'];
             if ($_REQUEST->valid('logo')) {
                 $comp->logo = $_REQUEST['logo'];
                 if ($_REQUEST->valid('url')) {
                     $comp->URL = $_REQUEST['url'];
                     if ($_REQUEST->valid('weight')) {
                         $comp->weight = $_REQUEST['weight'];
                         if ($_REQUEST->valid('type')) {
                             $comp->type = $_REQUEST['type'];
                             if (isset($_REQUEST['redirect'])) {
                                 $comp->redirect = 1;
                             } else {
                                 $comp->redirect = 0;
                             }
                             /* 								Log::write('Company('.$comp->name.') was updated'); */
                             Flash::create(__('Company was updated'), 'confirmation');
                         } else {
                             Flash::create(__('Company type invalid'), 'warning');
                         }
                     } else {
                         Flash::create(__('Company weight must not be empty'), 'warning');
                     }
                 } else {
                     Flash::create(__('Company URL must not be empty'), 'warning');
                 }
             } else {
                 Flash::create(__('Company logo must not be empty'), 'warning');
             }
         } else {
             Flash::create(__('Company name must not be empty'), 'warning');
         }
     } elseif ($_REQUEST['madd']) {
         if ($Controller->menuEditor->mayI(EDIT) && ($obj = $Controller->{$_REQUEST['madd']}('Company'))) {
             $obj->move('last');
             redirect(url(array('id' => 'menuEditor', 'status' => 'ok'), false, false));
         }
     } elseif ($_REQUEST->numeric('delCompany')) {
         if ($Controller->{$_REQUEST['delCompany']}(DELETE) && $Controller->{$_REQUEST['delCompany']}->delete()) {
             /* 			Log::write('Company was deleted'); */
             Flash::create(__('Company was deleted'));
         }
     }
     /**
      * Display page
      */
     if ($_REQUEST->valid('edit')) {
         $this->content = array('header' => $_REQUEST['edit'] == 'new' ? __('New company') : __('Edit company'), 'main' => $this->companyForm($_REQUEST['edit']));
     } else {
         $this->content = array('header' => $this->Name, 'main' => $this->displayCompanies());
     }
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:98,代码来源:CompanyEditor.php

示例11: saveFormData

 function saveFormData()
 {
     global $DB, $Controller, $USER;
     if (!$this->mayI(READ) || !$this->isActive('form')) {
         return false;
     }
     $_POST->setType('uform', 'string', true);
     if (!$_POST['uform']) {
         return false;
     }
     /*
      * Is there a limit to consider?
      */
     if ($this->_Limit > 0) {
         if ($this->PostCount >= $this->_Limit) {
             Flash::create(__('Submissions has reached the limit'), 'warning');
             return false;
         }
     }
     $r = $DB->formfields->get(array('id' => $this->ID));
     $okay = array();
     while (false !== ($field = Database::fetchAssoc($r))) {
         if (isset($_POST['uform'][$field['field_id']]) || in_array($field['type'], array('Checkbox', 'pCheckbox'))) {
             $value = '';
             $Possible_Values = array_map('trim', explode(',', $field['value']));
             if (in_array($field['type'], array('select', 'mselect', 'Radio')) || in_array($field['type'], array('Checkbox', 'pCheckbox')) && count($Possible_Values) > 1) {
                 $key_hash = array_map('md5', $Possible_Values);
                 $Possible_Values = array_combine($key_hash, $Possible_Values);
                 $Legitimate_Values = array();
                 $fv = (array) $_POST['uform'][$field['field_id']];
                 foreach ($fv as $fd) {
                     if (isset($Possible_Values[$fd])) {
                         $Legitimate_Values[] = $Possible_Values[$fd];
                     }
                 }
                 $value = join(', ', $Legitimate_Values);
             } elseif (in_array($field['type'], array('pCheckbox', 'Checkbox'))) {
                 $value = isset($_POST['uform'][$field['field_id']]);
             } elseif (!is_array($_POST['uform'][$field['field_id']])) {
                 $value = $_POST['uform'][$field['field_id']];
             } else {
                 continue;
             }
             $okay['field_id'][] = $field['field_id'];
             $okay['value'][] = $value;
         }
     }
     if (!empty($okay)) {
         $duplicate = array();
         foreach ($okay['field_id'] as $i => $fieldname) {
             $duplicate[] = "`field_id`='" . $fieldname . "' AND `value`='" . $okay['value'][$i] . "'";
         }
         $okay['id'] = $this->ID;
         $okay['post_id'] = uniqid();
         $okay['field_id'][] = 'poster';
         $okay['value'][] = $USER->ID;
         if ($DB->getCell("SELECT MAX(`c`) FROM (SELECT COUNT(*) as `c` FROM (\n    (SELECT `post_id` FROM `formdata` WHERE `id`='" . $this->ID . "' AND (`field_id`='poster' AND `value`='" . $DB->escape($USER->ID) . "')) as `t1`)\n    LEFT JOIN formdata USING(`post_id`) WHERE ((" . implode(") OR (", $duplicate) . "))\nGROUP BY `post_id`) as `t2`") == count($duplicate)) {
             Flash::create(__('Duplicate submission'));
         } else {
             $okay['field_id'][] = 'posted';
             $okay['value'][] = time();
             $okay['field_id'][] = 'poster:ip';
             $okay['value'][] = $_SERVER['REMOTE_ADDR'];
             $okay['field_id'][] = 'language';
             $okay['value'][] = $this->loadedLanguage;
             $DB->formdata->insertMultiple($okay);
             Flash::create(__('We have received your submission'), 'confirmation');
             ++$this->_PostCount;
         }
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:71,代码来源:UserForm.php

示例12: run

 /**
  * (non-PHPdoc)
  * @see lib/Page#run()
  */
 function run()
 {
     global $DB, $USER, $Controller, $Templates, $CONFIG;
     /**
      * User input types
      */
     $_REQUEST->setType('del', 'numeric');
     $_REQUEST->setType('fname', 'string');
     $_REQUEST->setType('action', 'string');
     $_REQUEST->setType('popup', 'string');
     $_REQUEST->setType('filter', 'string');
     $_REQUEST->setType('referrer', 'string');
     $_REQUEST->addType('edit', 'numeric');
     if ($_REQUEST['del'] && ($v = $Controller->{$_REQUEST['del']}(DELETE))) {
         $pid = @$this->Dir->ID;
         $v->delete();
         Flash::create(__('The file/directory was deleted'));
     }
     $groups = $USER->groupIds;
     array_walk($groups, create_function('$id', 'Files::userDir($id);'));
     $r = '';
     if ($Controller->{ADMIN_GROUP}(OVERRIDE)->isMember($USER)) {
         $objs = array($Controller->fileRoot);
     } else {
         $privilegeIDS = array_merge((array) $USER->ID, $USER->groupIds);
         $objs = array_merge($Controller->getClass('Folder', ANYTHING, false, false), $Controller->get($DB->{'spine,privileges'}->asList(array('spine.class' => 'File'), 'spine.id'), ANYTHING, false, false));
     }
     $Folders = $Files = array();
     foreach ($objs as $obj) {
         $p = $obj;
         while ($p = $p->Dir) {
             if (!$p->may($USER, READ)) {
                 break;
             } elseif (isset($objs[$p->ID])) {
                 continue 2;
             }
         }
         if (is_a($obj, 'Folder')) {
             if (!in_array($obj->filename, $this->ignore)) {
                 $Folders[$obj->filename] = $obj;
             }
         } elseif (is_a($obj, 'File')) {
             $Files[$obj->filename] = $obj;
         }
     }
     if ($_REQUEST['popup']) {
         Head::add("function select(id) {try{window.opener.fileCallback(id,'{$_REQUEST['popup']}');} catch(err) {}window.close();}", 'js-raw');
     }
     ksort($Folders);
     foreach ($Folders as $Folder) {
         $r .= $Folder->genHTML();
     }
     if (!empty($Files)) {
         ksort($Files);
         Head::add($CONFIG->UI->jQuery_theme . '/jquery-ui-*', 'css-lib');
         $r .= '<div class="ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"><span class="fixed-width">';
         $r .= __('Files');
         $r .= '</span></div>';
         $r .= '<ul class="filetree">';
         $i = 0;
         foreach ($Files as $cur) {
             if (!$cur->may($USER, READ)) {
                 continue;
             }
             if ($_REQUEST['filter']) {
                 switch ($_REQUEST['filter']) {
                     case 'images':
                     case 'documents':
                         if (!in_array(strtolower($cur->extension), $CONFIG->extensions->{$_REQUEST['filter']})) {
                             continue 2;
                         }
                         break;
                     default:
                         if (!stristr($cur->basename, $_REQUEST['filter'])) {
                             continue 2;
                         }
                 }
             }
             $r .= '<li class="' . ($i % 2 ? 'odd' : 'even') . ' file ext_' . $cur->extension . '"><span class="fixed-width">';
             if ($_REQUEST['popup']) {
                 $r .= '<a href="javascript: select(' . $cur->ID . ');">';
             }
             $r .= $cur->basename;
             if ($_REQUEST['popup']) {
                 $r .= '</a>';
             }
             $r .= '</span><div class="tools">' . ($cur->mayI(EDIT_PRIVILEGES) ? icon('small/key', __('Edit permissions'), url(array('id' => 'PermissionEditor', 'edit' => $cur->ID, 'referrer' => $this->ID), array('popup', 'filter'))) : '') . ($cur->mayI(EDIT) ? icon('small/door_in', __('Move'), url(array('id' => $cur->ID, 'referrer' => $this->ID), array('popup', 'filter'))) : '') . ($cur->mayI(DELETE) ? icon('small/delete', __('Delete'), url(array('del' => $cur->ID), array('id', 'popup', 'filter'))) : '') . icon('large/down-16', __('Download'), url(array('id' => $cur->ID, 'action' => 'download'), array('popup', 'filter'))) . '</div></li>';
             $i++;
         }
         $r .= '</ul>';
     }
     $this->setContent('header', __('Files and directories'));
     $this->setContent('main', $r);
     $t = 'admin';
     if ($_REQUEST['popup']) {
         $t = 'popup';
//.........这里部分代码省略.........
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:101,代码来源:Files.php

示例13: run

 /**
  * Display the page for managing installations
  * @see lib/Page#run()
  */
 function run()
 {
     global $USER, $CONFIG, $Templates, $SITE, $Controller;
     if (!$this->may($USER, READ)) {
         return;
     }
     $_REQUEST->setType('place', 'numeric');
     $_REQUEST->setType('parent', 'numeric');
     $_REQUEST->setType('reinstall', 'string');
     $_REQUEST->setType('new', 'string');
     if ($this->mayI(EDIT)) {
         if ($_REQUEST['reinstall']) {
             $this->reinstall($_REQUEST['reinstall']);
             Flash::create($_REQUEST['reinstall'] . ' ' . __('was reinstalled'));
         } elseif ($_REQUEST['new']) {
             $class = $_REQUEST['new'];
             if (validInclude($class) && ($class == 'MenuItem' || @is_subclass_of($class, 'MenuItem')) && $Controller->menuEditor->mayI(EDIT)) {
                 $obj = $Controller->newObj($class);
                 $obj->move($_REQUEST['place'] ? $_REQUEST['place'] : 'last', $_REQUEST['parent']);
                 Flash::queue(__('New') . ' ' . $class . ' ' . __('installed'));
                 redirect(url(array('id' => 'menuEditor')));
             }
             unset($class);
         }
     }
     $installed = $CONFIG->base->installed;
     $dir = 'plugins';
     $fullpath = ROOTDIR . DIRECTORY_SEPARATOR . $dir;
     $entries = readDirFilesRecursive($fullpath, true);
     natcasesort($entries);
     $i = 0;
     $c = array();
     foreach ($entries as $entry) {
         if (substr($entry, -4) == '.php') {
             $class = substr($entry, false, -4);
             $methods = class_exists($class) ? get_class_methods($class) : array();
             $c[] = '<span class="fixed-width">' . $class . '</span><div class="tools">' . ($this->may($USER, EDIT) && (@in_array('installable', $methods) && @in_array('install', $methods) && call_user_func(array($class, 'installable')) == $class) ? icon('small/arrow_refresh_small', __('Reinstall'), url(array('reinstall' => $class), array('id'))) : '') . (($class == 'MenuItem' || @is_subclass_of($class, 'MenuItem')) && $Controller->menuEditor->may($USER, EDIT) ? icon('small/add', __('Add new instance to menu'), url(array('new' => $class), array('id'))) : '') . '</div>';
         }
     }
     $this->setContent('header', __('Installer'));
     $this->setContent('main', listify($c));
     $Templates->admin->render();
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:47,代码来源:Installer.php

示例14: move

 function move($newRow, $newPlace)
 {
     global $DB;
     if (!is_numeric($newRow) || !is_numeric($newPlace)) {
         return false;
     }
     if ($this->row == $newRow && $this->place == $newPlace) {
         return true;
     }
     $size = $DB->pagelayout->getCell(array('id!' => $this->ID, 'pid' => $this->page, 'row' => $newRow), "SUM(`size`)");
     if ($size + $this->size > $this->maxcols) {
         Flash::create('Can\'t perform move! The box won\'t fit');
         return false;
     }
     $length = $DB->pagelayout->count(array('pid' => $this->page, 'row' => $newRow));
     if ($newPlace > $length) {
         $newPlace = $length;
     }
     $tonext = $this->row == $newRow && $this->place !== false && $newPlace == $this->place + 1;
     $DB->pagelayout->update(array('!!place' => '(`pagelayout`.`place`+1)'), array('pid' => $this->page, 'place>' . ($tonext ? '' : '=') => $newPlace, 'row' => $newRow), false, false);
     $DB->pagelayout->update(array('row' => $newRow, 'place' => $newPlace + $tonext), array('id' => $this->ID), true);
     if ($this->place !== false) {
         $DB->pagelayout->update(array('!!place' => '(`pagelayout`.`place`-1)'), array('pid' => $this->page, 'place>' => $this->place, 'row' => $this->row), false, false);
     }
     $this->place = $newPlace;
     $this->row = $newRow;
     return true;
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:28,代码来源:PageLayoutEditor.php

示例15: saveChanges

 function saveChanges()
 {
     $changes = false;
     $_REQUEST->setType('delgroup', 'string');
     $_REQUEST->setType('editGroup', 'any');
     /**
      * Deletion of a group
      */
     if ($_REQUEST['delgroup']) {
         if ($this->that->mayI(DELETE)) {
             $g = $Controller->{$_REQUEST['delgroup']};
             if (is_a($g, 'Group')) {
                 $this->that->delete();
                 Flash::queue(__('The group was deleted and all privileges were removed'));
                 redirect(url());
             }
         }
     }
     $_POST->setType('presentation', 'any');
     if ($_POST['presentation']) {
         $this->saveContent(array('presentation' => $_POST['presentation']));
     }
     $_REQUEST->setType('rem', 'numeric');
     $_REQUEST->setType('add', 'numeric');
     if ($_REQUEST['add']) {
         if ($this->that->addMember($_REQUEST['add'])) {
             if ($_REQUEST['nGM']) {
                 Flash::create(__('Group added as subgroup'));
             } else {
                 Flash::create(__('User added to group'), 'confirmation');
             }
         } else {
             Flash::create(__('Action failed'), 'warning');
         }
     } elseif ($_REQUEST['rem']) {
         if ($this->that->removeMember($_REQUEST['rem'])) {
             Flash::create(__('User removed from group'), 'confirmation');
         } else {
             Flash::create(__('User could not be removed from group'), 'warning');
         }
     }
     if ($_REQUEST['group_action'] && $_REQUEST['gid']) {
         if ($_REQUEST['group_action'] == 'reset_members') {
             if ($rgroup = $Controller->{$_REQUEST['gid']}('Group')) {
                 $rgroup->resetMembers();
                 Flash::create(__('Members removed'), 'confirmation');
             }
         } elseif ($_REQUEST['group_action'] == 'copy_members') {
             if (($from_group = $Controller->{$_REQUEST['gid']}('Group')) && ($to_group = $Controller->{$_REQUEST['copy_to_group']}('Group'))) {
                 $to_group->addMembers($from_group->MEMBERS);
                 Flash::create(__('Members copied'), 'confirmation');
             }
         }
     }
     $_POST->setType('gtype', 'string');
     $_POST->setType('gimage', 'numeric');
     $_POST->setType('dispmembers', 'bool');
     if ($_POST['gtype']) {
         $this->that->GroupType = $_POST['gtype'];
         $this->that->DisplayMembers = $_POST['dispmembers'];
         $this->that->Image = $_POST['gimage'];
     }
 }
开发者ID:jonatanolofsson,项目名称:solidba.se,代码行数:63,代码来源:GroupAdmin.php


注:本文中的Flash::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。