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


PHP record_exists函数代码示例

本文整理汇总了PHP中record_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP record_exists函数的具体用法?PHP record_exists怎么用?PHP record_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: addvariantform_validate

function addvariantform_validate(Pieform $form, $values)
{
    global $USER, $SESSION;
    require_once 'file.php';
    require_once 'uploadmanager.php';
    // Make sure they didn't hack the hidden variable to have the name of
    // a font that doesn't exist
    if (!record_exists('skin_fonts', 'name', $values['fontname'])) {
        $form->set_error('fontname', get_string('nosuchfont', 'skin'));
    }
    $uploadfiles = array('fontfileEOT' => array('required' => true, 'suffix' => 'eot'), 'fontfileSVG' => array('required' => true, 'suffix' => 'svg'), 'fontfileTTF' => array('required' => true, 'suffix' => 'ttf'), 'fontfileWOFF' => array('required' => true, 'suffix' => 'woff'));
    foreach ($uploadfiles as $inputname => $details) {
        $um = new upload_manager($inputname, false, null, $details['required']);
        if ($error = $um->preprocess_file()) {
            $form->set_error($inputname, $error);
        }
        if ($details['suffix']) {
            $reqext = ".{$details['suffix']}";
            $fileext = substr($values[$inputname]['name'], -1 * strlen($reqext));
            if ($fileext != $reqext) {
                $form->set_error($inputname, get_string('notvalidfontfile', 'skin', strtoupper($details['suffix'])));
            }
        }
    }
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:25,代码来源:add.php

示例2: repository_alfresco_get_category_filter

/**
 * Get the list of categories selected from the admin configured filter list and
 * perform some basic cleanup of that list.
 *
 * @uses $CFG
 * @param none
 * @return array An array of category DB object IDs.
 */
function repository_alfresco_get_category_filter()
{
    global $CFG;
    if (empty($CFG->repository_alfresco_catfilter)) {
        return array();
    }
    if ($catfilter = unserialize($CFG->repository_alfresco_catfilter)) {
        $updated = array();
        $changed = false;
        /// Make sure all the selected categories actually exist in the DB.
        foreach ($catfilter as $cat) {
            if (record_exists('alfresco_categories', 'id', $cat)) {
                $updated[] = $cat;
            } else {
                $changed = true;
            }
        }
        /// Update and store any changes.
        if ($changed) {
            set_config('repository_alfresco_catfilter', implode(',', $updated));
            $catfilter = $updated;
        }
    }
    return $catfilter;
}
开发者ID:remotelearner,项目名称:elis.alfresco,代码行数:33,代码来源:lib.php

示例3: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER, $THEME;
     $configdata = $instance->get('configdata');
     $desiredtypes = array();
     foreach ($configdata as $k => $v) {
         if (!empty($v) && $k != 'maxitems') {
             $type = preg_replace('/[^a-z]+/', '', $k);
             $desiredtypes[$type] = $type;
         }
     }
     if ($USER->get('admin') && !empty($desiredtypes['adminmessages'])) {
         unset($desiredtypes['adminmessages']);
         $desiredtypes += get_column('activity_type', 'name', 'admin', 1);
     }
     $maxitems = isset($configdata['maxitems']) ? $configdata['maxitems'] : 5;
     // check if multirecipientnotification plugin is active or if we proceed here
     if (record_exists('module_installed', 'name', 'multirecipientnotification', 'active', '1') && safe_require_plugin('module', 'multirecipientnotification')) {
         global $USER;
         $userid = $USER->get('id');
         $activitylist = activityblocklistin(join(',', $desiredtypes), $maxitems);
         $records = $activitylist->records;
         $showmore = $activitylist->count > $maxitems;
         // use a different template
         $smartytemplate = 'blocktype:inbox:inboxmr.tpl';
     } else {
         $records = array();
         if ($desiredtypes) {
             $sql = "\n                    SELECT n.id, n.subject, n.message, n.url, n.urltext, n.read, t.name AS type\n                    FROM {notification_internal_activity} n JOIN {activity_type} t ON n.type = t.id\n                    WHERE n.usr = ?\n                    AND t.name IN (" . join(',', array_map('db_quote', $desiredtypes)) . ")\n                    ORDER BY n.ctime DESC\n                    LIMIT ?;";
             $records = get_records_sql_array($sql, array($USER->get('id'), $maxitems + 1));
         }
         // Hack to decide whether to show the More... link
         if ($showmore = count($records) > $maxitems) {
             unset($records[$maxitems]);
         }
         if ($records) {
             foreach ($records as &$r) {
                 $r->message = format_notification_whitespace($r->message, $r->type);
             }
         }
         $smartytemplate = 'blocktype:inbox:inbox.tpl';
     }
     if ($records) {
         require_once 'activity.php';
         foreach ($records as &$r) {
             $section = empty($r->plugintype) ? 'activity' : "{$r->plugintype}.{$r->pluginname}";
             $r->strtype = get_string('type' . $r->type, $section);
         }
     }
     $smarty = smarty_core();
     if ($showmore) {
         $smarty->assign('morelink', self::get_link($instance) . '?type=' . implode(',', $desiredtypes));
     }
     $smarty->assign('blockid', 'blockinstance_' . $instance->get('id'));
     $smarty->assign('items', $records);
     return $smarty->fetch($smartytemplate);
 }
开发者ID:sarahjcotton,项目名称:mahara,代码行数:57,代码来源:lib.php

示例4: print_header

 /**
  * Prints the page header.
  */
 function print_header()
 {
     global $CFG, $USER, $PAGE;
     require_once $CFG->libdir . '/blocklib.php';
     require_once $CFG->dirroot . '/course/lib.php';
     require_once $CFG->dirroot . '/my/pagelib.php';
     /// My Moodle arguments:
     $edit = optional_param('edit', -1, PARAM_BOOL);
     $blockaction = optional_param('blockaction', '', PARAM_ALPHA);
     $mymoodlestr = get_string('mymoodle', 'my');
     if (isguest()) {
         $wwwroot = $CFG->wwwroot . '/login/index.php';
         if (!empty($CFG->loginhttps)) {
             $wwwroot = str_replace('http:', 'https:', $wwwroot);
         }
         print_header($mymoodlestr);
         notice_yesno(get_string('noguest', 'my') . '<br /><br />' . get_string('liketologin'), $wwwroot, $CFG->wwwroot);
         print_footer();
         die;
     }
     /// Add curriculum stylesheets...
     if (file_exists($CFG->dirroot . '/curriculum/styles.css')) {
         $CFG->stylesheets[] = $CFG->wwwroot . '/curriculum/styles.css';
     }
     /// Fool the page library into thinking we're in My Moodle.
     $CFG->pagepath = $CFG->wwwroot . '/my/index.php';
     $PAGE = page_create_instance($USER->id);
     if ($section = optional_param('section', '', PARAM_ALPHAEXT)) {
         $PAGE->section = $section;
     }
     $this->pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
     /// Make sure that the curriculum block is actually on this
     /// user's My Moodle page instance.
     if ($cablockid = get_field('block', 'id', 'name', 'curr_admin')) {
         if (!record_exists('block_pinned', 'blockid', $cablockid, 'pagetype', 'my-index')) {
             blocks_execute_action($PAGE, $this->pageblocks, 'add', (int) $cablockid, true, false);
         }
     }
     if ($edit != -1 and $PAGE->user_allowed_editing()) {
         $USER->editing = $edit;
     }
     //$PAGE->print_header($mymoodlestr);
     $title = $this->get_title();
     print_header($title, $title, build_navigation($this->get_navigation()));
     echo '<table border="0" cellpadding="3" cellspacing="0" width="100%" id="layout-table">';
     echo '<tr valign="top">';
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($this->pageblocks[BLOCK_POS_LEFT]), 210);
     if (blocks_have_content($this->pageblocks, BLOCK_POS_LEFT) || $PAGE->user_is_editing()) {
         echo '<td style="vertical-align: top; width: ' . $blocks_preferred_width . 'px;" id="left-column">';
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_LEFT);
         echo '</td>';
     }
     echo '<td valign="top" id="middle-column">';
     if (blocks_have_content($this->pageblocks, BLOCK_POS_CENTRE) || $PAGE->user_is_editing()) {
         blocks_print_group($PAGE, $this->pageblocks, BLOCK_POS_CENTRE);
     }
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:60,代码来源:newpage.class.php

示例5: i_set_account_settings

 /**
  * Sets the specified account settings to the current user.
  * A table with | Setting label | value | is expected.
  *
  * @Given /^I set the following account settings values:$/
  * @param TableNode $table
  */
 public function i_set_account_settings(TableNode $table)
 {
     global $USER;
     $prefs = array();
     foreach ($table->getHash() as $accountpref) {
         $prefs[$accountpref['field']] = $accountpref['value'];
     }
     // Validate the settings
     if (isset($prefs['urlid']) && get_config('cleanurls') && $prefs['urlid'] != $USER->get('urlid')) {
         if (strlen($prefs['urlid']) < 3) {
             throw new Exception("Invalid urlid: " . get_string('rule.minlength.minlength', 'pieforms', 3));
         } else {
             if (record_exists('usr', 'urlid', $prefs['urlid'])) {
                 throw new Exception("Invalid urlid: " . get_string('urlalreadytaken', 'account'));
             }
         }
     }
     if (get_config('allowmobileuploads')) {
         foreach ($prefs['mobileuploadtoken'] as $k => $text) {
             if (strlen($text) > 0 && !preg_match('/^[a-zA-Z0-9 !@#$%^&*()\\-_=+\\[{\\]};:\'",<\\.>\\/?]{6,}$/', $text)) {
                 throw new Exception("Invalid mobileuploadtoken: " . get_string('badmobileuploadtoken', 'account'));
             }
         }
     }
     // Update user's account settings
     db_begin();
     // use this as looping through values is not safe.
     $expectedprefs = expected_account_preferences();
     if (isset($prefs['maildisabled']) && $prefs['maildisabled'] == 0 && get_account_preference($USER->get('id'), 'maildisabled') == 1) {
         // Reset the sent and bounce counts otherwise mail will be disabled
         // on the next send attempt
         $u = new StdClass();
         $u->email = $USER->get('email');
         $u->id = $USER->get('id');
         update_bounce_count($u, true);
         update_send_count($u, true);
     }
     // Remember the user's language & theme prefs, so we can reload the page if they change them
     $oldlang = $USER->get_account_preference('lang');
     $oldtheme = $USER->get_account_preference('theme');
     $oldgroupsideblockmaxgroups = $USER->get_account_preference('groupsideblockmaxgroups');
     $oldgroupsideblocksortby = $USER->get_account_preference('groupsideblocksortby');
     if (get_config('allowmobileuploads') && isset($prefs['mobileuploadtoken'])) {
         // Make sure the mobile token is formatted / saved correctly
         $prefs['mobileuploadtoken'] = array_filter($prefs['mobileuploadtoken']);
         $new_token_pref = '|' . join('|', $prefs['mobileuploadtoken']) . '|';
         $USER->set_account_preference('mobileuploadtoken', $new_token_pref);
         unset($prefs['mobileuploadtoken']);
     }
     // Set user account preferences
     foreach ($expectedprefs as $eprefkey => $epref) {
         if (isset($prefs[$eprefkey]) && $prefs[$eprefkey] !== get_account_preference($USER->get('id'), $eprefkey)) {
             $USER->set_account_preference($eprefkey, $prefs[$eprefkey]);
         }
     }
     db_commit();
 }
开发者ID:banterweb,项目名称:mahara,代码行数:64,代码来源:BehatAccount.php

示例6: search_all

function search_all($query_string, $limit, $offset = 0, $data = array(), $type = null)
{
    if (record_exists('search_installed', 'name', 'elasticsearch', 'active', 1)) {
        safe_require('search', 'elasticsearch');
        $plugin = 'elasticsearch';
        $results = call_static_method(generate_class_name('search', $plugin), 'search_all', $query_string, $limit, $offset, $data, $type);
        return $results;
    }
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:9,代码来源:searchlib.php

示例7: can_view_cluster

 function can_view_cluster()
 {
     global $USER;
     $context = get_context_instance(CONTEXT_SYSTEM);
     $crlm_uid = cm_get_crlmuserid($USER->id);
     if (empty($crlm_uid)) {
         $crlm_uid = -1;
     }
     return $this->can_view_admin() || has_capability('block/curr_admin:viewgroupreports', $context) || record_exists(CLSTASSTABLE, 'userid', $crlm_uid, 'leader', 1);
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:10,代码来源:jasperreportpage.class.php

示例8: restore_map

 function restore_map($old_question_id, $new_question_id, $info, $restore)
 {
     $matchs = $info['#']['MATCHS']['0']['#']['MATCH'];
     foreach ($matchs as $match) {
         $match_sub_id = backup_todb($match['#']['ID']['0']['#']);
         if (!record_exists('question_match_sub', 'id', $match_sub_id)) {
             throw new SharingCart_XmlException('match sub question not found');
         }
         backup_putid($restore->backup_unique_code, 'question_match_sub', $match_sub_id, $match_sub_id);
     }
     return backup_putid($restore->backup_unique_code, 'question', $old_question_id, $new_question_id);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:SharingCart_qtype_match.php

示例9: validation

 function validation($data, $files)
 {
     global $CFG;
     $errors = parent::validation($data, $files);
     $data = (object) $data;
     $category = get_record('user_info_category', 'id', $data->id);
     /// Check the name is unique
     if ($category and $category->name !== $data->name and record_exists('user_info_category', 'name', $data->name)) {
         $errors['name'] = get_string('profilecategorynamenotunique', 'admin');
     }
     return $errors;
 }
开发者ID:kai707,项目名称:ITSA-backup,代码行数:12,代码来源:index_category_form.php

示例10: set_config

 public static function set_config($plugin, $data, $user = 0)
 {
     if (record_exists('sharing_cart_plugins', 'plugin', $plugin, 'user', $user)) {
         return set_field('sharing_cart_plugins', 'data', serialize($data), 'plugin', $plugin, 'user', $user);
     } else {
         $record = new stdClass();
         $record->plugin = $plugin;
         $record->user = $user;
         $record->data = serialize($data);
         return insert_record('sharing_cart_plugins', $record);
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:plugins.php

示例11: openid_normalize_url_as_username

/**
 * (originally from lib.php)
 * Normalize an OpenID url for use as a username in the users table
 *
 * The function will ensure the returned username is not present in the
 * database.  It will do this by incrementing an appended number until the
 * username is not found.
 *
 * @param string $openid_url
 * @return string
 */
function openid_normalize_url_as_username($openid_url)
{
    $username = eregi_replace('[^a-z0-9]', '', $openid_url);
    $username = substr($username, 0, 90);
    // Keep it within limits of schema
    $username_tmp = $username;
    $i = 1;
    while (record_exists('user', 'username', $username)) {
        $username = $username_tmp . $i++;
    }
    return $username;
}
开发者ID:remotelearner,项目名称:elis.openid,代码行数:23,代码来源:locallib.php

示例12: is_available

 /**
  * Specifies whether the current report is available
  * (a.k.a. any the CM system is installed)
  *
  * @return  boolean  True if the report is available, otherwise false
  */
 function is_available()
 {
     global $CFG;
     //we need the curriculum directory
     if (!file_exists($CFG->dirroot . '/curriculum/config.php')) {
         return false;
     }
     //we also need the curr_admin block
     if (!record_exists('block', 'name', 'curr_admin')) {
         return false;
     }
     //everything needed is present
     return true;
 }
开发者ID:remotelearner,项目名称:elis.reporting,代码行数:20,代码来源:sitewide_course_completion_report.class.php

示例13: restore_map

 function restore_map($old_question_id, $new_question_id, $info, $restore)
 {
     $multianswers = $info['#']['MULTIANSWERS']['0']['#']['MULTIANSWER'];
     foreach ($multianswers as $multianswer) {
         $sequence = $multianswer['#']['SEQUENCE']['0']['#'];
         $child_question_ids = array_filter(explode(',', $sequence));
         foreach ($child_question_ids as $child_question_id) {
             if (!record_exists('question', 'id', $child_question_id)) {
                 throw new SharingCart_XmlException('cloze child question not found');
             }
             backup_putid($restore->backup_unique_code, 'question', $child_question_id, $child_question_id);
         }
     }
     return backup_putid($restore->backup_unique_code, 'question', $old_question_id, $new_question_id);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:15,代码来源:SharingCart_qtype_cloze.php

示例14: validation

 function validation($data)
 {
     global $CFG;
     $data = (object) $data;
     $err = array();
     $category = get_record('user_info_category', 'id', $data->id);
     /// Check the name is unique
     if ($category and $category->name !== $data->name and record_exists('user_info_category', 'name', $data->name)) {
         $err['name'] = get_string('profilecategorynamenotunique', 'admin');
     }
     if (count($err) == 0) {
         return true;
     } else {
         return $err;
     }
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:16,代码来源:index_category_form.php

示例15: render_instance

 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $USER, $exporter;
     $userid = $instance->get_view()->get('owner');
     if (!$userid) {
         // 'My Friends' doesn't make sense for group/site views
         return '';
     }
     $limit = isset($exporter) ? false : MAXFRIENDDISPLAY;
     $friends = get_friends($userid, $limit, 0);
     if ($friends['count']) {
         self::build_myfriends_html($friends, $userid, $instance);
     } else {
         $friends = false;
     }
     $smarty = smarty_core();
     $smarty->assign('friends', $friends);
     $smarty->assign('searchingforfriends', array('<a href="' . get_config('wwwroot') . 'user/find.php">', '</a>'));
     // If the user has no friends, try and display something useful, such
     // as a 'request friendship' button
     if (!$friends) {
         $loggedinid = $USER->get('id');
         $is_friend = is_friend($userid, $loggedinid);
         if ($is_friend) {
             $relationship = 'existingfriend';
         } else {
             if (record_exists('usr_friend_request', 'requester', $loggedinid, 'owner', $userid)) {
                 $relationship = 'requestedfriendship';
             } else {
                 $relationship = 'none';
                 $friendscontrol = get_account_preference($userid, 'friendscontrol');
                 if ($friendscontrol == 'auto') {
                     require_once 'pieforms/pieform.php';
                     $newfriendform = pieform(array('name' => 'myfriends_addfriend', 'successcallback' => 'addfriend_submit', 'autofocus' => false, 'renderer' => 'div', 'elements' => array('add' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default', 'value' => '<span class="icon icon-user-plus icon-lg prs"></span>' . get_string('addtomyfriends', 'group')), 'id' => array('type' => 'hidden', 'value' => $userid))));
                     $smarty->assign('newfriendform', $newfriendform);
                 }
                 $smarty->assign('friendscontrol', $friendscontrol);
             }
         }
         $smarty->assign('relationship', $relationship);
     }
     $smarty->assign('loggedin', is_logged_in());
     $smarty->assign('lookingatownpage', $USER->get('id') == $userid);
     $smarty->assign('USERID', $userid);
     return $smarty->fetch('blocktype:myfriends:myfriends.tpl');
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:46,代码来源:lib.php


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