Example #1
0
function xrd_init(&$a)
{
    $uri = urldecode(notags(trim($_GET['uri'])));
    if (substr($uri, 0, 4) === 'http') {
        $name = basename($uri);
    } else {
        $local = str_replace('acct:', '', $uri);
        if (substr($local, 0, 2) == '//') {
            $local = substr($local, 2);
        }
        $name = substr($local, 0, strpos($local, '@'));
    }
    $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($name));
    if (!count($r)) {
        killme();
    }
    $salmon_key = salmon_key($r[0]['spubkey']);
    header('Access-Control-Allow-Origin: *');
    header("Content-type: text/xml");
    if (get_config('system', 'diaspora_enabled')) {
        //$tpl = file_get_contents('view/xrd_diaspora.tpl');
        $tpl = get_markup_template('xrd_diaspora.tpl');
        $dspr = replace_macros($tpl, array('$baseurl' => $a->get_baseurl(), '$dspr_guid' => $r[0]['guid'], '$dspr_key' => base64_encode(pemtorsa($r[0]['pubkey']))));
    } else {
        $dspr = '';
    }
    //$tpl = file_get_contents('view/xrd_person.tpl');
    $tpl = get_markup_template('xrd_person.tpl');
    $o = replace_macros($tpl, array('$nick' => $r[0]['nickname'], '$accturi' => $uri, '$profile_url' => $a->get_baseurl() . '/profile/' . $r[0]['nickname'], '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['nickname'], '$atom' => $a->get_baseurl() . '/dfrn_poll/' . $r[0]['nickname'], '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['nickname'], '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['nickname'], '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'] . '.jpg', '$dspr' => $dspr, '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'], '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention', '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, '$bigkey' => salmon_key($r[0]['pubkey'])));
    $arr = array('user' => $r[0], 'xml' => $o);
    call_hooks('personal_xrd', $arr);
    echo $arr['xml'];
    killme();
}
Example #2
0
function deletepost_submit(Pieform $form, $values)
{
    global $SESSION, $USER;
    $objectionable = get_record_sql("SELECT fp.id\n            FROM {interaction_forum_post} fp\n            JOIN {objectionable} o\n            ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n            WHERE fp.id = ?\n            AND o.resolvedby IS NULL\n            AND o.resolvedtime IS NULL", array($values['post']));
    if ($objectionable !== false) {
        // Trigger activity.
        $data = new StdClass();
        $data->postid = $values['post'];
        $data->message = '';
        $data->reporter = $USER->get('id');
        $data->ctime = time();
        $data->event = DELETE_OBJECTIONABLE_POST;
        activity_occurred('reportpost', $data, 'interaction', 'forum');
    }
    update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post']));
    $SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum'));
    // Figure out which parent record to redirect us to. If the parent record is deleted,
    // keep moving up the chain until you find one that's not deleted.
    $postrec = new stdClass();
    $postrec->parent = $values['parent'];
    do {
        $postrec = get_record('interaction_forum_post', 'id', $postrec->parent, null, null, null, null, 'id, deleted, parent');
    } while ($postrec && $postrec->deleted && $postrec->parent);
    $redirecturl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $values['topic'];
    if ($postrec && $postrec->parent) {
        $redirecturl .= '&post=' . $postrec->id;
    }
    redirect($redirecturl);
}
Example #3
0
 function definition()
 {
     global $CFG, $PAGE;
     $mform = $this->_form;
     $config = get_config('folder');
     //-------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     $mform->addElement('text', 'name', get_string('name'), array('size' => '48'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     $this->add_intro_editor($config->requiremodintro);
     $mform->addElement('date_time_selector', 'starttime', get_string('', 'mod_hangout'));
     $this->standard_coursemodule_elements();
     //-------------------------------------------------------
     $this->add_action_buttons();
     //-------------------------------------------------------
     $mform->addElement('hidden', 'revision');
     $mform->setType('revision', PARAM_INT);
     $mform->setDefault('revision', 1);
 }
Example #4
0
function config($key)
{
    static $config_static;
    global $config;
    // UPLOAD_SECRET has a special meaning when empty
    if ($key == 'UPLOAD_SECRET' && (!isset($config['UPLOAD_SECRET']) || $config['UPLOAD_SECRET'] == '')) {
        fatal_error('toegang voor roostermakers is niet geconfigureerd');
    }
    // is this key in the static config?
    // these values can be accessed without database access
    if (isset($config[$key])) {
        return $config[$key];
    }
    // nope, so look in the DB
    if (!isset($config_static)) {
        $config_static = get_config();
    }
    if (!isset($config_static[$key])) {
        fatal_error("Config key {$key} is not set?!?!");
    }
    /*
    	echo('<pre>');
    	print_r($config_static);
    	echo('</pre>');
    	exit;
    */
    return $config_static[$key];
}
Example #5
0
function newmember_content(&$a)
{
    $o = '<h3>' . t('Welcome to Friendica') . '</h3>';
    $o .= '<h3>' . t('New Member Checklist') . '</h3>';
    $o .= '<div style="font-size: 120%;">';
    $o .= t('We would like to offer some tips and links to help make your experience enjoyable. Click any item to visit the relevant page. A link to this page will be visible from your home page for two weeks after your initial registration and then will quietly disappear.');
    $o .= '<ul>';
    $o .= '<li>' . '<a target="newmember" href="settings">' . t('On your <em>Settings</em> page -  change your initial password. Also make a note of your Identity Address. This looks just like an email address - and will be useful in making friends on the free social web.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="settings">' . t('Review the other settings, particularly the privacy settings. An unpublished directory listing is like having an unlisted phone number. In general, you should probably publish your listing - unless all of your friends and potential friends know exactly how to find you.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="profile_photo">' . t('Upload a profile photo if you have not done so already. Studies have shown that people with real photos of themselves are ten times more likely to make friends than people who do not.') . '</a></li>' . EOL;
    if (in_array('facebook', $a->plugins)) {
        $o .= '<li>' . '<a target="newmember" href="facebook">' . t("Authorise the Facebook Connector if you currently have a Facebook account and we will (optionally) import all your Facebook friends and conversations.") . '</a></li>' . EOL;
    } else {
        $o .= '<li>' . '<a target="newmember" href="help/Installing-Connectors">' . t("<em>If</em> this is your own personal server, installing the Facebook addon may ease your transition to the free social web.") . '</a></li>' . EOL;
    }
    $mail_disabled = function_exists('imap_open') && !get_config('system', 'imap_disabled') ? 0 : 1;
    if (!$mail_disabled) {
        $o .= '<li>' . '<a target="newmember" href="settings/connectors">' . t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</a></li>' . EOL;
    }
    $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Edit your <strong>default</strong> profile to your liking. Review the settings for hiding your list of friends and hiding the profile from unknown visitors.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="profiles">' . t('Set some public keywords for your default profile which describe your interests. We may be able to find other people with similar interests and suggest friendships.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="directory">' . t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="contacts">' . t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="contacts">' . t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</a></li>' . EOL;
    $o .= '<li>' . '<a target="newmember" href="help">' . t('Our <strong>help</strong> pages may be consulted for detail on other program features and resources.') . '</a></li>' . EOL;
    $o .= '</div>';
    return $o;
}
Example #6
0
function login_ad($user_, $pass_, $tipo_)
{
    //Comienzo la conexión al servidor para tomar los datos de active directory
    $host = get_config('host');
    $puerto = get_config('puerto');
    $filter = "sAMAccountName=" . $user_ . "*";
    $attr = array("displayname", "mail", "givenname", "sn", "useraccountcontrol");
    $dn = get_config('dn');
    $conex = ldap_connect($host, $puerto) or die("No ha sido posible conectarse al servidor");
    if (!ldap_set_option($conex, LDAP_OPT_PROTOCOL_VERSION, 3)) {
        echo "<br>Failed to set protocol version to 3";
    }
    if ($conex) {
        $dominio = get_config("dominio");
        $r = @ldap_bind($conex, $user_ . $dominio, $pass_);
        $existe = get_perfil($user_, $tipo_);
        if ($r && count($existe) > 0) {
            //LOGIN CORRECTO
            $result = ldap_search($conex, $dn, $filter, $attr);
            $entries = ldap_get_entries($conex, $result);
            for ($i = 0; $i < $entries["count"]; $i++) {
                $nombre = fix_data(utf8_decode($entries[$i]["givenname"][0]));
                $apellidos = fix_data(utf8_decode($entries[$i]["sn"][0]));
                $email = fix_data($entries[$i]["mail"][0]);
                //Acutalizar información desde AD en la tabla de empleados
                $s_ = "update empleados set nombre='{$nombre}', apellidos='{$apellidos}', mail='{$email}' where id='{$existe['id']}'";
                $r_ = mysql_query($s_);
                session_name("loginUsuario");
                session_start();
                $_SESSION['NAME'] = $nombre . " " . $apellidos;
                $_SESSION['USER'] = $user_;
                $_SESSION['IDEMP'] = $existe['id'];
                $_SESSION['AUSENCIA'] = get_ausencia($existe['id']);
                $_SESSION['DEPTO'] = $existe['depto'];
                $_SESSION['TYPE'] = $tipo_;
            }
            switch ($tipo_) {
                case "administrador":
                    header("Location: admin/inicio.php");
                    break;
                case "capturista":
                    header("Location: capturista/inicio.php");
                    break;
                case "autorizador":
                    header("Location: autorizador/scrap_firmar.php");
                    break;
                case "reportes":
                    header("Location: reportes/rep_general.php?op=listado");
                    break;
            }
        } else {
            echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php?error=2&user_={$user_}&tipo_={$tipo_}\">";
            exit;
        }
        ldap_close($conex);
    } else {
        echo "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0; URL=index.php?error=3&user_={$user_}&tipo_={$tipo_}\">";
        exit;
    }
}
Example #7
0
 public static function notify_user($user, $data)
 {
     $lang = empty($user->lang) || $user->lang == 'default' ? get_config('lang') : $user->lang;
     $separator = str_repeat('-', 72);
     $sitename = get_config('sitename');
     $subject = get_string_from_language($lang, 'emailsubject', 'notification.email', $sitename);
     if (!empty($data->subject)) {
         $subject .= ': ' . $data->subject;
     }
     $messagebody = get_string_from_language($lang, 'emailheader', 'notification.email', $sitename) . "\n";
     $messagebody .= $separator . "\n\n";
     $messagebody .= get_string_from_language($lang, 'subject') . ': ' . $data->subject . "\n\n";
     if ($data->activityname == 'usermessage') {
         // Do not include the message body in user messages when they are sent by email
         // because it encourages people to reply to the email.
         $messagebody .= get_string_from_language($lang, 'newusermessageemailbody', 'group', display_name($data->userfrom), $data->url);
     } else {
         $messagebody .= $data->message;
         if (!empty($data->url)) {
             $messagebody .= "\n\n" . get_string_from_language($lang, 'referurl', 'notification.email', $data->url);
         }
     }
     if (isset($data->unsubscribeurl) && isset($data->unsubscribename)) {
         $messagebody .= "\n\n" . get_string_from_language($lang, 'unsubscribemessage', 'notification.email', $data->unsubscribename, $data->unsubscribeurl);
     }
     $messagebody .= "\n\n{$separator}";
     $prefurl = get_config('wwwroot') . 'account/activity/preferences/';
     $messagebody .= "\n\n" . get_string_from_language($lang, 'emailfooter', 'notification.email', $sitename, $prefurl);
     email_user($user, null, $subject, $messagebody, null, !empty($data->customheaders) ? $data->customheaders : null);
 }
Example #8
0
 function validation($data, $files) {
     if (get_config('block_cobalt_reports', 'sqlsecurity')) {
         return $this->validation_high_security($data, $files);
     } else {
         return $this->validation_low_security($data, $files);
     }
 }
Example #9
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     safe_require('artefact', 'survey');
     //require_once(dirname(dirname(dirname(__FILE__))) . '/dwoo/function.survey_name.php');
     $configdata = $instance->get('configdata');
     // this will make sure to unserialize it for us
     if (!isset($configdata['artefactid'])) {
         return '';
     }
     $id = $configdata['artefactid'];
     $survey = $instance->get_artefact_instance($id);
     $showresponses = isset($configdata['showresponses']) ? $configdata['showresponses'] : false;
     $showresults = isset($configdata['showresults']) ? $configdata['showresults'] : true;
     $showchart = isset($configdata['showchart']) ? $configdata['showchart'] : true;
     $palette = isset($configdata['palette']) ? $configdata['palette'] : 'default';
     $legend = isset($configdata['legend']) ? $configdata['legend'] : 'key';
     $fonttype = isset($configdata['fonttype']) ? $configdata['fonttype'] : 'sans';
     $fontsize = isset($configdata['fontsize']) ? $configdata['fontsize'] : 10;
     $height = isset($configdata['height']) ? $configdata['height'] : 250;
     $width = isset($configdata['width']) ? $configdata['width'] : 400;
     $smarty = smarty_core();
     //$smarty->addPlugin('survey_name', 'Dwoo_Plugin_survey_name');
     $smarty->assign('RESPONSES', $showresponses ? true : false);
     $smarty->assign('responseshtml', ArtefactTypeSurvey::build_user_responses_output_html($survey->get('title'), unserialize($survey->get('description'))));
     $smarty->assign('RESULTS', $showresults ? true : false);
     $smarty->assign('resultshtml', ArtefactTypeSurvey::build_user_responses_summary_html($survey->get('title'), unserialize($survey->get('description'))));
     $smarty->assign('CHART', $showchart ? true : false);
     $smarty->assign('charturl', get_config('wwwroot') . 'artefact/survey/chart.php?id=' . $id . '&width=' . $width . '&height=' . $height . '&palette=' . $palette . '&legend=' . $legend . '&fonttype=' . $fonttype . '&fontsize=' . $fontsize);
     return $smarty->fetch('blocktype:survey:survey.tpl');
 }
Example #10
0
/**
 * @param int $oldversion the version we are upgrading from
 * @return bool result
 */
function xmldb_repository_dropbox_upgrade($oldversion) {
    global $CFG, $DB;

    $dbman = $DB->get_manager();

    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this

    if ($oldversion < 2012080702) {
        // Set the default value for dropbox_cachelimit
        $value = get_config('dropbox', 'dropbox_cachelimit');
        if (empty($value)) {
            set_config('dropbox_cachelimit', 1024*1024, 'dropbox');
        }
        upgrade_plugin_savepoint(true, 2012080702, 'repository', 'dropbox');
    }

    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this


    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.


    return true;
}
Example #11
0
 public function create_instance($record = null, array $options = null)
 {
     global $CFG;
     require_once $CFG->libdir . '/filelib.php';
     $workshopconfig = get_config('workshop');
     // Add default values for workshop.
     $record = (array) $record + array('strategy' => $workshopconfig->strategy, 'grade' => $workshopconfig->grade, 'gradinggrade' => $workshopconfig->gradinggrade, 'gradedecimals' => $workshopconfig->gradedecimals, 'nattachments' => 1, 'maxbytes' => $workshopconfig->maxbytes, 'latesubmissions' => 0, 'useselfassessment' => 0, 'overallfeedbackmode' => 1, 'overallfeedbackfiles' => 0, 'overallfeedbackmaxbytes' => $workshopconfig->maxbytes, 'useexamples' => 0, 'examplesmode' => $workshopconfig->examplesmode, 'submissionstart' => 0, 'submissionend' => 0, 'phaseswitchassessment' => 0, 'assessmentstart' => 0, 'assessmentend' => 0);
     if (!isset($record['gradecategory']) || !isset($record['gradinggradecategory'])) {
         require_once $CFG->libdir . '/gradelib.php';
         $courseid = is_object($record['course']) ? $record['course']->id : $record['course'];
         $gradecategories = grade_get_categories_menu($courseid);
         reset($gradecategories);
         $defaultcategory = key($gradecategories);
         $record += array('gradecategory' => $defaultcategory, 'gradinggradecategory' => $defaultcategory);
     }
     if (!isset($record['instructauthorseditor'])) {
         $record['instructauthorseditor'] = array('text' => 'Instructions for submission ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     if (!isset($record['instructreviewerseditor'])) {
         $record['instructreviewerseditor'] = array('text' => 'Instructions for assessment ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     if (!isset($record['conclusioneditor'])) {
         $record['conclusioneditor'] = array('text' => 'Conclusion ' . ($this->instancecount + 1), 'format' => FORMAT_MOODLE, 'itemid' => file_get_unused_draft_itemid());
     }
     return parent::create_instance($record, (array) $options);
 }
Example #12
0
/**
 * Mahara: Electronic portfolio, weblog, resume builder and social networking
 * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    mahara
 * @subpackage form
 * @author     Catalyst IT Ltd
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
 *
 */
function pieform_element_captcha(Pieform $form, $element)
{
    $id = $form->get_name() . '_' . $element['name'];
    $image = '<img src="' . get_config('wwwroot') . 'captcha.php?name=' . $id . '" alt="' . get_string('captchaimage') . '" style="padding: 2px 0;"><br>';
    $input = '<input type="text" class="text required" id="' . $id . '" name="' . $element['name'] . '" style="width: 137px;" tabindex="' . $form->get_property('tabindex') . '">';
    return $image . ' ' . $input;
}
Example #13
0
 /**
  * 设置菜单
  */
 public function menu_setting()
 {
     $weixin_config = get_config('weixin_config');
     define(AppId, $weixin_config['appid']);
     //定义AppId,需要在微信公众平台申请自定义菜单后会得到
     define(AppSecret, $weixin_config['secret']);
     //定义AppSecret,需要在微信公众平台申请自定义菜单后会得到
     load_function('curl');
     if (isset($GLOBALS['submit'])) {
         $menu_setting = trim($GLOBALS['form']['menu_setting']);
         $menu = load_class('menu', 'weixin');
         //引入微信类
         $creatMenu = $menu->creatMenu($menu_setting);
         //创建菜单
         $creatMenu_arr = json_decode($creatMenu, true);
         if ($creatMenu_arr['errcode'] != 0) {
             MSG($creatMenu);
         } else {
             $this->db->update('setting', array('data' => $menu_setting), array('m' => 'weixin', 'keyid' => 'configs'));
             MSG('创建成功,菜单将在24小时后生效,您可以取消关注,再关注看到最新菜单');
         }
     } else {
         $r = $this->db->get_one('setting', array('m' => 'weixin', 'keyid' => 'configs'));
         $menu_setting = $r['data'];
         include $this->template('menu_setting');
     }
 }
Example #14
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $configdata = $instance->get('configdata');
     $viewid = $instance->get('view');
     $wwwroot = get_config('wwwroot');
     $files = array();
     if (isset($configdata['artefactids']) && is_array($configdata['artefactids'])) {
         foreach ($configdata['artefactids'] as $artefactid) {
             try {
                 $artefact = $instance->get_artefact_instance($artefactid);
             } catch (ArtefactNotFoundException $e) {
                 continue;
             }
             $file = array('id' => $artefactid, 'title' => $artefact->get('title'), 'description' => $artefact->get('description'), 'size' => $artefact->get('size'), 'ctime' => $artefact->get('ctime'), 'artefacttype' => $artefact->get('artefacttype'), 'iconsrc' => call_static_method(generate_artefact_class_name($artefact->get('artefacttype')), 'get_icon', array('id' => $artefactid, 'viewid' => $viewid)), 'downloadurl' => $wwwroot);
             if ($artefact instanceof ArtefactTypeProfileIcon) {
                 $file['downloadurl'] .= 'thumb.php?type=profileiconbyid&id=' . $artefactid;
             } else {
                 if ($artefact instanceof ArtefactTypeFile) {
                     $file['downloadurl'] .= 'artefact/file/download.php?file=' . $artefactid . '&view=' . $viewid;
                 }
             }
             $file['is_image'] = $artefact instanceof ArtefactTypeImage ? true : false;
             $files[] = $file;
         }
     }
     $smarty = smarty_core();
     $smarty->assign('viewid', $instance->get('view'));
     $smarty->assign('files', $files);
     return $smarty->fetch('blocktype:filedownload:filedownload.tpl');
 }
Example #15
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     global $exporter;
     require_once get_config('docroot') . 'artefact/lib.php';
     safe_require('artefact', 'plans');
     $configdata = $instance->get('configdata');
     $smarty = smarty_core();
     if (isset($configdata['artefactid'])) {
         $plan = artefact_instance_from_id($configdata['artefactid']);
         $tasks = ArtefactTypeTask::get_tasks($configdata['artefactid']);
         $template = 'artefact:plans:taskrows.tpl';
         $blockid = $instance->get('id');
         if ($exporter) {
             $pagination = false;
         } else {
             $baseurl = $instance->get_view()->get_url();
             $baseurl .= (false === strpos($baseurl, '?') ? '?' : '&') . 'block=' . $blockid;
             $pagination = array('baseurl' => $baseurl, 'id' => 'block' . $blockid . '_pagination', 'datatable' => 'tasktable_' . $blockid, 'jsonscript' => 'artefact/plans/viewtasks.json.php');
         }
         ArtefactTypeTask::render_tasks($tasks, $template, $configdata, $pagination);
         if ($exporter && $tasks['count'] > $tasks['limit']) {
             $artefacturl = get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $configdata['artefactid'] . '&view=' . $instance->get('view');
             $tasks['pagination'] = '<a href="' . $artefacturl . '">' . get_string('alltasks', 'artefact.plans') . '</a>';
         }
         $smarty->assign('owner', $plan->get('owner'));
         $smarty->assign('tags', $plan->get('tags'));
         $smarty->assign('tasks', $tasks);
     } else {
         $smarty->assign('noplans', 'blocktype.plans/plans');
     }
     $smarty->assign('blockid', $instance->get('id'));
     return $smarty->fetch('blocktype:plans:content.tpl');
 }
Example #16
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     require_once get_config('docroot') . 'artefact/lib.php';
     $configdata = $instance->get('configdata');
     $configdata['viewid'] = $instance->get('view');
     $configdata['simpledisplay'] = true;
     // This can be either an image or profileicon. They both implement
     // render_self
     $result = '';
     $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
     if ($artefactid) {
         $artefact = $instance->get_artefact_instance($artefactid);
         $result = $artefact->render_self($configdata);
         $result = $result['html'];
         require_once get_config('docroot') . 'artefact/comment/lib.php';
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($configdata['viewid']);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
     }
     $smarty = smarty_core();
     if ($artefactid) {
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
     }
     $smarty->assign('html', $result);
     return $smarty->fetch('blocktype:folder:folder.tpl');
 }
Example #17
0
 function find_by_page($page = 1)
 {
     $limit = get_config('productions.per_page');
     $offset = ($page - 1) * $limit;
     $productions = Production::find('all', array('order' => 'id desc', 'limit' => $limit, 'offset' => $offset));
     return $productions;
 }
Example #18
0
 /**
  * Returns an array of CalendarColumn's, containing the seminar-entries
  * for the passed user (in the passed semester belonging to the passed institute)
  * The start- and end-hour are used to constrain the returned
  * entries to the passed time-period. The passed days constrain the entries
  * to these.
  *
  * @param string  $user_id       the ID of the user
  * @param array   $semester      an array containing the "beginn" of the semester
  * @param int     $start_hour    the start hour
  * @param int     $end_hour      the end hour
  * @param string  $institute_id  the ID of the institute
  * @param array   $days          the days to be displayed
  * @return array  an array containing the entries
  */
 static function getInstituteEntries($user_id, $semester, $start_hour, $end_hour, $institute_id, $days)
 {
     // fetch seminar-entries, show invisible seminars if the user has enough perms
     $visibility_perms = $GLOBALS['perm']->have_perm(get_config('SEM_VISIBILITY_PERM'));
     $stmt = DBManager::get()->prepare("SELECT * FROM seminare\n            LEFT JOIN seminar_inst ON (seminare.Seminar_id = seminar_inst.seminar_id)\n            WHERE seminar_inst.institut_id = :institute\n                AND (start_time = :begin\n                    OR (start_time < :begin AND duration_time = -1)\n                    OR (start_time + duration_time >= :begin AND start_time <= :begin)) " . (!$visibility_perms ? " AND visible='1'" : ""));
     $stmt->bindParam(':begin', $semester['beginn']);
     $stmt->bindParam(':institute', $institute_id);
     $stmt->execute();
     while ($entry = $stmt->fetch()) {
         $seminars[$entry['Seminar_id']] = $entry;
     }
     if (is_array($seminars)) {
         foreach ($seminars as $data) {
             $entries = self::getSeminarEntry($data['Seminar_id'], $user_id);
             foreach ($entries as $entry) {
                 unset($entry['url']);
                 $entry['onClick'] = 'function(id) { STUDIP.Instschedule.showInstituteDetails(id); }';
                 $entry['visible'] = 1;
                 if ($entry['start'] >= $start_hour * 100 && $entry['start'] <= $end_hour * 100 || $entry['end'] >= $start_hour * 100 && $entry['end'] <= $end_hour * 100) {
                     $entry['color'] = DEFAULT_COLOR_SEM;
                     $day_number = ($entry['day'] + 6) % 7;
                     if (!isset($ret[$day_number])) {
                         $ret[$day_number] = CalendarColumn::create($day_number);
                     }
                     $ret[$day_number]->addEntry($entry);
                 }
             }
         }
     }
     return CalendarScheduleModel::addDayChooser($ret, $days, 'instschedule');
 }
 /**
  * Form definition
  */
 public function definition()
 {
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $config = get_config('local_mass_enroll');
     $mform->addElement('header', 'general', '');
     // Fill in the data depending on page params.
     // Later using set_data.
     $mform->addElement('filepicker', 'attachment', get_string('location', 'enrol_flatfile'));
     $mform->addRule('attachment', null, 'required');
     $choices = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter_name', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter_name', 'semicolon');
         } else {
             $mform->setDefault('delimiter_name', 'comma');
         }
     }
     $choices = \core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $ids = array('idnumber' => get_string('idnumber', 'local_mass_enroll'), 'username' => get_string('username', 'local_mass_enroll'), 'email' => get_string('email'));
     $mform->addElement('select', 'firstcolumn', get_string('firstcolumn', 'local_mass_enroll'), $ids);
     $mform->setDefault('firstcolumn', 'idnumber');
     $mform->addElement('selectyesno', 'mailreport', get_string('mailreport', 'local_mass_enroll'));
     $mform->setDefault('mailreport', (int) $config->mailreportdefault);
     // Buttons.
     $this->add_action_buttons(true, get_string('unenroll', 'local_mass_enroll'));
     $mform->addElement('hidden', 'id', $course->id);
     $mform->setType('id', PARAM_INT);
 }
Example #20
0
 public function __construct()
 {
     global $native_language_names_init;
     $this->active_ui_languages = explode(' ', get_config('active_ui_languages'));
     // Set active user interface languages
     $this->native_language_names = array();
     foreach ($this->active_ui_languages as $langcode) {
         if (isset($native_language_names_init[$langcode])) {
             $this->native_language_names[$langcode] = $native_language_names_init[$langcode];
         }
     }
     if (isset($_REQUEST['localize'])) {
         $this->language = $_SESSION['langswitch'] = $this->validate_language_code($_REQUEST['localize']);
     } elseif (isset($_SESSION['langswitch'])) {
         $this->language = $_SESSION['langswitch'];
     } else {
         $this->language = get_config('default_language');
     }
     if (isset($_SESSION['uid'])) {
         $this->user_id = $_SESSION['uid'];
     } else {
         $this->user_id = 0;
     }
     if (isset($_SESSION['status'])) {
         $this->status = intval($_SESSION['status']);
     } else {
         $this->status = 0;
     }
     if (isset($_SESSION['login_timestamp'])) {
         $this->login_timestamp = $_SESSION['login_timestamp'];
     } else {
         $this->login_timestamp = false;
     }
 }
Example #21
0
 /**
  * Iniciamos el Núcleo del sistema
  * @param array $initial_data Arreglo con los datos (tiempo y RAM) iniciales
  * @return nothing
  */
 public static function init($initial_data = null)
 {
     // Nos aseguramos de que sólo una vez se inicialice la clase
     if (self::$initialized === false) {
         self::$initialized = true;
         self::$config = get_config('core');
         if ($initial_data !== null) {
             self::$initial_data = (array) $initial_data;
         }
         self::$avaiable_controllers = get_config('routes');
         self::load_components();
         // Asignamos las rutas predefinidas del sistema.
         if (self::is_valid_route(self::$config['default_controller'], self::$config['default_method']) === true) {
             self::$default_routing = array('controller' => self::$config['default_controller'], 'method' => self::$config['default_method']);
         } else {
             throw new Core_Exception('La ruta predefinida es inv&aacute;lida.', self::$error);
         }
         if (self::is_valid_route(self::$config['error_controller'], self::$config['error_method']) === true) {
             self::$error_routes = array('controller' => self::$config['error_controller'], 'method' => self::$config['error_method']);
         } else {
             throw new Core_Exception('La ruta de fallos es inv&aacute;lida.');
             // Master Error
         }
         // Cargamos configuraciones del sitio y las preferencias del usuario
         //TODO: Crear el modelo de preferencias de usuario
         self::route();
     }
 }
function xmldb_theme_formal_white_upgrade($oldversion)
{
    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this
    if ($oldversion < 2012051503) {
        $currentsetting = get_config('theme_formal_white');
        if (isset($currentsetting->displaylogo)) {
            // useless but safer
            // Create a new config setting called headercontent and give it the current displaylogo value.
            set_config('headercontent', $currentsetting->displaylogo, 'theme_formal_white');
            unset_config('displaylogo', 'theme_formal_white');
        }
        if (isset($currentsetting->logo)) {
            // useless but safer
            // Create a new config setting called headercontent and give it the current displaylogo value.
            set_config('customlogourl', $currentsetting->logo, 'theme_formal_white');
            unset_config('logo', 'theme_formal_white');
        }
        if (isset($currentsetting->frontpagelogo)) {
            // useless but safer
            // Create a new config setting called headercontent and give it the current displaylogo value.
            set_config('frontpagelogourl', $currentsetting->frontpagelogo, 'theme_formal_white');
            unset_config('frontpagelogo', 'theme_formal_white');
        }
        upgrade_plugin_savepoint(true, 2012051503, 'theme', 'formal_white');
    }
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
Example #23
0
 /**
  * Constructor
  */
 public function __construct($gtree, $moving = false, $gpr)
 {
     global $USER, $OUTPUT, $COURSE;
     $systemdefault = get_config('moodle', 'grade_report_showcalculations');
     $this->show_calculations = get_user_preferences('grade_report_showcalculations', $systemdefault);
     $this->gtree = $gtree;
     $this->moving = $moving;
     $this->gpr = $gpr;
     $this->deepest_level = $this->get_deepest_level($this->gtree->top_element);
     $this->columns = array(grade_edit_tree_column::factory('name', array('deepest_level' => $this->deepest_level)));
     if ($this->uses_weight) {
         $this->columns[] = grade_edit_tree_column::factory('weight', array('adv' => 'weight'));
     }
     $this->columns[] = grade_edit_tree_column::factory('range');
     // This is not a setting... How do we deal with it?
     $this->columns[] = grade_edit_tree_column::factory('actions');
     if ($this->deepest_level > 1) {
         $this->columns[] = grade_edit_tree_column::factory('select');
     }
     $this->table = new html_table();
     $this->table->id = "grade_edit_tree_table";
     $this->table->attributes['class'] = 'generaltable simple setup-grades';
     if ($this->moving) {
         $this->table->attributes['class'] .= ' moving';
     }
     foreach ($this->columns as $column) {
         if (!($this->moving && $column->hide_when_moving)) {
             $this->table->head[] = $column->get_header_cell();
         }
     }
     $rowcount = 0;
     $this->table->data = $this->build_html_tree($this->gtree->top_element, true, array(), 0, $rowcount);
 }
Example #24
0
    function definition() {
        global $CFG, $DB;
        $mform = $this->_form;

        $config = get_config('imscp');

        //-------------------------------------------------------
        $mform->addElement('header', 'general', get_string('general', 'form'));
        $mform->addElement('text', 'name', get_string('name'), array('size'=>'48'));
        if (!empty($CFG->formatstringstriptags)) {
            $mform->setType('name', PARAM_TEXT);
        } else {
            $mform->setType('name', PARAM_CLEANHTML);
        }
        $mform->addRule('name', null, 'required', null, 'client');
        $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
        $this->add_intro_editor($config->requiremodintro);

        //-------------------------------------------------------
        $mform->addElement('header', 'content', get_string('contentheader', 'imscp'));
        $mform->addElement('filepicker', 'package', get_string('packagefile', 'imscp'));

        $options = array('-1'=>get_string('all'), '0'=>get_string('no'), '1'=>'1', '2'=>'2', '5'=>'5', '10'=>'10', '20'=>'20');
        $mform->addElement('select', 'keepold', get_string('keepold', 'imscp'), $options);
        $mform->setDefault('keepold', $config->keepold);
        $mform->setAdvanced('keepold', $config->keepold_adv);

        //-------------------------------------------------------
        $this->standard_coursemodule_elements();

        //-------------------------------------------------------
        $this->add_action_buttons();
    }
 function get_required_javascript() {
     $this->page->requires->js('/blocks/cobalt_reports/js/datatables/media/js/jquery.js', true);
     $this->page->requires->js('/blocks/reportdashboard/ajax.js', true);
     switch (get_config('block_cobalt_reports', 'reportchartui')) {
         case 'highcharts':
             $this->page->requires->js('/blocks/cobalt_reports/js/highcharts/highcharts.js', true);
             $this->page->requires->js('/blocks/cobalt_reports/js/highcharts/exporting.js', true);
             break;
         case 'd3':
             $this->page->requires->js('/blocks/cobalt_reports/js/nvd3/d3.v3.js', true);
             $this->page->requires->js('/blocks/cobalt_reports/js/nvd3/nv.d3.js', true);
             $this->page->requires->js('/blocks/cobalt_reports/js/nvd3/utils.js', true);
             break;
     }
     switch (get_config('block_cobalt_reports', 'reporttableui')) {
         case 'datatables':
             $this->page->requires->js('/blocks/cobalt_reports/js/datatables/media/js/jquery.dataTables.min.js');
             $this->page->requires->js('/blocks/cobalt_reports/js/datatables/media/js/dataTables.colVis.js');
             $this->page->requires->js('/blocks/cobalt_reports/js/datatables/extras/FixedHeader/js/FixedHeader.js');
             $this->page->requires->js('/blocks/cobalt_reports/js/datatables/media/js/dataTables.tableTools.js');
             break;
         case 'jquery':
             $this->page->requires->js('/blocks/cobalt_reports/js/jquery.tablesorter.min.js');
             break;
     }
 }
Example #26
0
 /**
  * Delayed initialisation of singleton.
  */
 protected function init()
 {
     if (isset($this->stores)) {
         // Do not bother checking readers and writers here
         // because everything is init here.
         return;
     }
     $this->stores = array();
     $this->readers = array();
     $this->writers = array();
     // Register shutdown handler - this may be useful for buffering, file handle closing, etc.
     \core_shutdown_manager::register_function(array($this, 'dispose'));
     $plugins = get_config('tool_log', 'enabled_stores');
     if (empty($plugins)) {
         return;
     }
     $plugins = explode(',', $plugins);
     foreach ($plugins as $plugin) {
         $classname = "\\{$plugin}\\log\\store";
         if (class_exists($classname)) {
             $store = new $classname($this);
             $this->stores[$plugin] = $store;
             if ($store instanceof \tool_log\log\writer) {
                 $this->writers[$plugin] = $store;
             }
             if ($store instanceof \core\log\reader) {
                 $this->readers[$plugin] = $store;
             }
         }
     }
 }
Example #27
0
 public static function render_instance(BlockInstance $instance, $editing = false)
 {
     $configdata = $instance->get('configdata');
     $result = '';
     $artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
     if ($artefactid) {
         require_once get_config('docroot') . 'artefact/lib.php';
         $artefact = $instance->get_artefact_instance($artefactid);
         $configdata['hidetitle'] = true;
         $configdata['countcomments'] = true;
         $configdata['viewid'] = $instance->get('view');
         $configdata['blockid'] = $instance->get('id');
         $result = $artefact->render_self($configdata);
         $result = $result['html'];
         require_once get_config('docroot') . 'artefact/comment/lib.php';
         require_once get_config('docroot') . 'lib/view.php';
         $view = new View($configdata['viewid']);
         list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
     }
     $smarty = smarty_core();
     if ($artefactid) {
         $smarty->assign('commentcount', $commentcount);
         $smarty->assign('comments', $comments);
     }
     $smarty->assign('html', $result);
     return $smarty->fetch('blocktype:blogpost:blogpost.tpl');
 }
Example #28
0
 /**
  * Constructor
  *
  * @access	public
  */
 function OCS_Log()
 {
     // adapted from CI's Log.php
     $config =& get_config();
     if (is_numeric($config['log_threshold'])) {
         $this->_threshold = $config['log_threshold'];
     }
     if ($config['log_date_format'] != '') {
         $this->_date_fmt = $config['log_date_format'];
     }
     if (isset($config['log_backtrace_func'])) {
         $this->_backtrace_func = $config['log_backtrace_func'];
     }
     if (isset($config['log_backtrace_line'])) {
         $this->_backtrace_line = $config['log_backtrace_line'];
     }
     if (isset($config['log_use_syslog'])) {
         $this->_use_syslog = $config['log_use_syslog'];
     }
     if (isset($config['log_syslog_facility'])) {
         $this->_syslog_facility = $config['log_syslog_facility'];
     }
     if ($this->_use_syslog === TRUE) {
         if (!openlog("ocs", LOG_PID, $this->_syslog_facility)) {
             $this->_enable = FALSE;
         }
     } else {
         $this->log_path = $config['log_path'] != '' ? $config['log_path'] : BASEPATH . 'logs/';
         if (!is_dir($this->log_path) or !is_really_writable($this->log_path)) {
             $this->_enabled = FALSE;
         }
     }
 }
 /**
  * 设置路由
  */
 private function setconfig()
 {
     $route_config = get_config('route_config', 'default');
     $this->_m = input('m') ? input('m') : $route_config['m'];
     $this->_f = input('f') ? input('f') : $route_config['f'];
     $this->_v = input('v') ? strip_tags(input('v')) : $route_config['v'];
 }
Example #30
0
function insert_analytics_tracking() {
    global $CFG;
    $enabled = get_config('local_analytics', 'enabled');
    $siteid = get_config('local_analytics', 'siteid');
    $trackadmin = get_config('local_analytics', 'trackadmin');
    $cleanurl = get_config('local_analytics', 'cleanurl');
    $location = "additionalhtml" . get_config('local_analytics', 'location');

    if ($enabled && (!is_siteadmin() || $trackadmin)) {
        $CFG->$location .= "
            <script type='text/javascript' name='localga'>
              var _gaq = _gaq || [];
              _gaq.push(['_setAccount', '" . $siteid . "']);
              _gaq.push(['_trackPageview'," . ($cleanurl ? analytics_trackurl() : '') . "]);
              _gaq.push(['_setSiteSpeedSampleRate', 50]);

              (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; 
                ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
              })();
            </script>
			";
    }
}