/**
  * Returns all the descriptions of a course.
  * @throws InvalidArgumentException if the $cid in not provided.
  * @webservice{/module/MOBILE/GEN/getResourcesList/cidReq}
  * @ws_arg{method,getResourcesList}
  * @ws_arg{cidReq,SYSCODE of requested cours}
  * @return array of Descriptions object
  */
 function getResourcesList($args)
 {
     $module = isset($args['module']) ? $args['module'] : null;
     $cid = claro_get_current_course_id();
     if ($cid == null || $module == null) {
         throw new InvalidArgumentException('Missing cid argument!');
     }
     $list = array();
     FromKernel::uses('core/linker.lib');
     ResourceLinker::init();
     $locator = new ClarolineResourceLocator($cid, $module, null, claro_get_current_group_id());
     if (ResourceLinker::$Navigator->isNavigable($locator)) {
         $resourceList = ResourceLinker::$Navigator->getResourceList($locator);
         foreach ($resourceList as $lnk) {
             $inLocator = $lnk->getLocator();
             $item['title'] = $lnk->getName();
             $item['visibility'] = $lnk->isVisible();
             $item['url'] = str_replace(get_path('url'), "", get_path('rootWeb')) . ResourceLinker::$Resolver->resolve($inLocator);
             if ($inLocator->hasResourceId()) {
                 $item['resourceId'] = $inLocator->getResourceId();
             } else {
                 $item['resourceId'] = $item['url'];
             }
             if (claro_is_allowed_to_edit() || $item['visibility']) {
                 $list[] = $item;
             }
         }
     }
     return $list;
 }
Beispiel #2
0
 public function renderContent()
 {
     global $platformLanguage;
     $out = '';
     // Last user action
     $lastUserAction = isset($_SESSION['last_action']) && $_SESSION['last_action'] != '1970-01-01 00:00:00' ? $_SESSION['last_action'] : date('Y-m-d H:i:s');
     $userCommands = array();
     // User commands
     // 'Create Course Site' command. Only available for teacher.
     if (claro_is_allowed_to_create_course()) {
         $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/create.php')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('courseadd') . '" alt="" /> ' . get_lang('Create a course site') . '</a>' . "\n";
     } elseif ($GLOBALS['currentUser']->isCourseCreator) {
         $userCommands[] = '<span class="userCommandsItemDisabled">' . '<img src="' . get_icon_url('courseadd') . '" alt="" /> ' . get_lang('Create a course site') . '</span>' . "\n";
     }
     if (get_conf('allowToSelfEnroll', true)) {
         $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=rqReg&amp;categoryId=0')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('enroll') . '" alt="" /> ' . get_lang('Enrol on a new course') . '</a>' . "\n";
         $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'auth/courses.php?cmd=rqUnreg')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('unenroll') . '" alt="" /> ' . get_lang('Remove course enrolment') . '</a>' . "\n";
     }
     $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'course/platform_courses.php')) . '" class="userCommandsItem">' . '<img src="' . get_icon_url('course') . '" alt="" /> ' . get_lang('All platform courses') . '</a>' . "\n";
     $userCommands[] = '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_path('clarolineRepositoryWeb') . 'notification_date.php')) . '" class="userCommandsItem">' . '<img class="iconDefinitionList" src="' . get_icon_url('hot') . '" alt="' . get_lang('New items') . '" />' . ' ' . get_lang('New items') . ' ' . get_lang('to another date') . (substr($lastUserAction, strlen($lastUserAction) - 8) == '00:00:00' ? ' [' . claro_html_localised_date(get_locale('dateFormatNumeric'), strtotime($lastUserAction)) . ']' : '') . '</a>' . "\n";
     $userCourseList = render_user_course_list();
     $userCourseListDesactivated = render_user_course_list_desactivated();
     $out .= '<div class="userCommands">' . '<h2>' . get_lang('Manage my courses') . '</h2>' . claro_html_list($userCommands) . '</div>' . '<div class="userCourseList">' . '<h2>' . get_lang('My course list') . '</h2>' . $userCourseList;
     if (!empty($userCourseListDesactivated)) {
         $out .= '<h4>' . get_lang('Deactivated course list') . '</h4>' . $userCourseListDesactivated;
     }
     $out .= '</div>';
     /*'</td>'
       . '</tr>'
       . '</tbody>'
       . '</table>'*/
     $this->content = $out;
     return $this->content;
 }
Beispiel #3
0
/**
 * A helper function to load the Nmwdhj classes.
 *
 * @return void
 * @since 1.2
 */
function class_loader($class_name)
{
    $nps = explode('\\', $class_name, 3);
    if ('Nmwdhj' !== $nps[0] || count($nps) === 1) {
        return;
    }
    switch ($nps[1]) {
        case 'Manager':
        case 'Exception':
        case 'EventManager':
        case 'PriorityArray':
            $class_path = get_path('core/Essentials.php');
            break;
        case 'Attributes':
            $class_path = get_path('core/Attributes.php');
            break;
        case 'Elements':
            if (!empty($nps[2])) {
                $class_path = get_path(sprintf('elements/%s.php', $nps[2]));
            }
            break;
        case 'Views':
            if (!empty($nps[2])) {
                $class_path = get_path(sprintf('elements/views/%s.php', $nps[2]));
            }
            break;
    }
    if (!empty($class_path) && file_exists($class_path)) {
        require $class_path;
    }
}
Beispiel #4
0
function addAdminScripts($hook_suffix)
{
    wp_register_script('', get_path('js') . '', array('jquery'), '', true);
    if ($hook_suffix == '') {
        wp_enqueue_script(array());
    }
}
Beispiel #5
0
 public function resolve(ResourceLocator $locator)
 {
     if ($locator->hasResourceId()) {
         $context = Claro_Context::getCurrentContext();
         $context[CLARO_CONTEXT_COURSE] = $locator->getCourseId();
         if ($locator->inGroup()) {
             $context[CLARO_CONTEXT_GROUP] = $locator->getGroupId();
         }
         $path = get_path('coursesRepositorySys') . claro_get_course_path($locator->getCourseId());
         // in a group
         if ($locator->inGroup()) {
             $groupData = claro_get_group_data($context);
             $path .= '/group/' . $groupData['directory'];
             $groupId = $locator->getGroupId();
         } else {
             $path .= '/document';
         }
         $path .= '/' . ltrim($locator->getResourceId(), '/');
         $resourcePath = '/' . ltrim($locator->getResourceId(), '/');
         $path = secure_file_path($path);
         if (!file_exists($path)) {
             throw new Exception("Resource not found {$path}");
         } elseif (is_dir($path)) {
             $url = new Url(get_module_entry_url('CLDOC'));
             $url->addParam('cmd', 'exChDir');
             $url->addParam('file', base64_encode($resourcePath));
             return $url->toUrl();
         } else {
             return get_module_url('CLDOC') . '/connector/cllp.frames.cnr.php';
             return claro_get_file_download_url($resourcePath, Claro_Context::getUrlContext($context));
         }
     } else {
         return get_module_entry_url('CLDOC');
     }
 }
Beispiel #6
0
function load_path($dir, $path)
{
    $file = get_path($dir, $path);
    if (file_exists($file)) {
        require_once $file;
    }
}
Beispiel #7
0
/**
 * CLAROLINE
 *
 * @version     $Revision: 13708 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     CLANN
 * @subpackage  CLICAL
 * @author      Claro Team <*****@*****.**>
 */
function CLANN_write_ical($iCal, $context)
{
    if (is_array($context) && count($context) > 0) {
        $courseId = array_key_exists(CLARO_CONTEXT_COURSE, $context) ? $context[CLARO_CONTEXT_COURSE] : claro_get_current_course_id();
    }
    require_once dirname(__FILE__) . '/../lib/announcement.lib.php';
    $courseData = claro_get_course_data($courseId);
    $toolNameList = claro_get_tool_name_list();
    $announcementList = announcement_get_item_list($context, 'DESC');
    $organizer = (array) array($courseData['titular'], $courseData['email']);
    $attendees = array();
    $categories = array(get_conf('siteName'), $courseData['officialCode'], trim($toolNameList['CLANN']));
    foreach ($announcementList as $announcementItem) {
        if ('SHOW' == $announcementItem['visibility']) {
            /*
            $rssList[] = array( 'title'       => trim($announcementItem['title'])
            ,                   'category'    => trim($toolNameList['CLANN'])
            ,                   'guid'        => get_module_url('CLANN') . '/announcements.php?cidReq='.claro_get_current_course_id().'&l#ann'.$announcementItem['id']
            ,                   'link'        => get_module_url('CLANN') . '/announcements.php?cidReq='.claro_get_current_course_id().'&l#ann'.$announcementItem['id']
            ,                   'description' => trim(str_replace('<!-- content: html -->','',$announcementItem['content']))
            ,                   'pubDate'     => date('r', stripslashes(strtotime($announcementItem['time'])))
            //,                   'author'      => $_course['email']
            );
            */
            $iCal->addJournal(trim($announcementItem['title']), trim(str_replace('<!-- content: html -->', '', $announcementItem['content'])), strtotime($announcementItem['time']), strtotime($announcementItem['time']), time(), 1, 1, $organizer, $attendees, $categories, 5, 10, 1, array(), 0, '', get_path('rootWeb') . get_module_url('CLANN') . '/announcements.php?cidReq=' . $courseId . '&amp;l#ann' . $announcementItem['id'], get_locale('iso639_1_code'), '');
        }
    }
    return $iCal;
}
Beispiel #8
0
function callback_parse_path($matches)
{
    if (count($matches) < 2) {
        return "";
    }
    return get_path($matches[1]);
}
Beispiel #9
0
 public function update($id, $args)
 {
     $langs = get_langs();
     if ($this->valid($args, $this->rules())) {
         $page = $this->findItem($id);
         $page->image = get_path($args['image']);
         $page->post_status = $args['post_status'];
         $page->template = $args['template'];
         if (!$page->update()) {
             throw new ExcuteException('save_error', 'Không lưu được');
         }
         $syncs = [];
         foreach ($langs as $lang) {
             $code = $args[$lang->code];
             $page_title = $code['post_title'];
             $slug = $code['slug'];
             $slug = trim($slug) == '' ? toSlug($page_title) : toSlug($slug);
             $page_desc = ['post_title' => $page_title, 'slug' => $slug, 'post_content' => $code['post_content'], 'post_excerpt' => $code['post_excerpt']];
             $syncs[$lang->id] = $page_desc;
         }
         $page->langs()->sync($syncs);
     } else {
         throw new ValidationException('Error Validation', 'Điền đầy đủ các thông tin!');
     }
 }
Beispiel #10
0
function GENERAR_ARTICULOS()
{
    $data = '';
    $categoria = isset($_GET['categoria']) ? db_codex($_GET['categoria']) : 0;
    if ($categoria) {
        $c = "SELECT * FROM ventas_categorias WHERE id_categoria='{$categoria}'";
        $resultado = db_consultar($c);
        if (db_resultado($resultado, 'padre') > 0) {
            $data .= "<h1>Mostrando publicaciones de la sub-categoria <span style='color:#00F'>" . db_resultado($resultado, 'nombre') . "</span></h1>";
            $data .= "Ubicación: " . get_path($categoria) . "<br />";
            $data .= "<hr />";
            $data .= "Deseo publicar una <a href=\"./vender?op={$categoria}\">venta</a> en esta categoría<br />";
            $data .= "<hr />";
            $WHERE = "z.id_categoria='{$categoria}'";
        } else {
            $data .= "<h1>Mostrando publicaciones recientes de la categoria <span style='color:#00F'>" . db_resultado($resultado, 'nombre') . "</span></h1>";
            $WHERE = "(SELECT padre FROM ventas_categorias AS b where b.id_categoria=z.id_categoria)='{$categoria}'";
        }
    } else {
        $data .= "<h1>Publicaciones mas recientes</h1>";
        // Mostrar todos los articulos recientes
        $WHERE = "1";
    }
    $WHERE .= "  AND z.tipo IN (" . _A_aceptado . "," . _A_promocionado . ") AND fecha_fin >= CURDATE()";
    $data .= VISTA_ListaPubs($WHERE, "ORDER BY promocionado DESC, fecha_ini DESC", "indice");
    return $data;
}
Beispiel #11
0
 /**
  * return the content
  *
  * @param coursecode $key
  * @param array $context
  * @return string : html content
  */
 public static function get_block($key, $isadmin, $context = null, $right = null)
 {
     $out = self::get_content($key, $context, $right);
     if ($isadmin) {
         $out .= '<p>' . "\n" . '<a href="' . get_path('rootAdminWeb') . 'managing/editFile.php?cmd=rqEdit&amp;file=textzone_messaging_top.inc.html">' . "\n" . '<img src="' . get_icon_url('edit') . '" alt="" />' . get_lang('Edit text zone') . "\n" . '</a>' . "\n" . '</p>';
     }
     return $out;
 }
Beispiel #12
0
/**
 * Sets up theme defaults and registers support for various features.
 */
function after_setup_theme()
{
    load_theme_textdomain(config('textdomain'), get_path('i18n'));
    // Let WordPress manage the document title.
    // By adding theme support, we declare that this theme does not use a
    // hard-coded <title> tag in the document head, and expect WordPress to
    // provide it for us.
    add_theme_support('title-tag');
}
 public function down()
 {
     $this->remove_access();
     $this->remove_menu();
     $this->remove_setting();
     @unlink(get_path('{www}{www image}/people'));
     $this->drop_table('cms_people');
     return true;
 }
Beispiel #14
0
/**
 * return true if the user in parameter is admin, false is the user in parameter is not admin
 *
 * @param int $userId
 * @return bool true if the user is admin
 *                 false if the user is not admin
 */
function claro_is_user_platform_admin($userId)
{
    static $uidAdmin = false;
    require_once get_path('incRepositorySys') . '/lib/user.lib.php';
    if (!$uidAdmin) {
        $uidAdmin = claro_get_uid_of_platform_admin();
    }
    return in_array($userId, $uidAdmin);
}
 public function down()
 {
     $this->remove_access();
     $this->remove_menu();
     $this->drop_table('cms_banners');
     /* remove only if empty */
     @unlink(get_path('{www}{www image}/banners'));
     return true;
 }
Beispiel #16
0
 /**
  * notify by email the user of the reception of a message
  *
  * @param array of int: $userDataList user identificatin list
  * @param MessageToSend $message message envoy�
  * @param int $messageId identification of the message
  * 
  */
 public function notify($userDataList, $message, $messageId)
 {
     if (!get_conf('mailNotification', TRUE)) {
         return;
     }
     // sender name and email
     if ($message->getSender() == 0) {
         $userData = array('mail' => get_conf('no_reply_mail') ? get_conf('no_reply_mail') : get_conf('administrator_email'), 'firstName' => get_lang('Message from %platformName', array('%platformName' => get_conf('siteName'))), 'lastName' => '');
     } else {
         $userData = claro_get_current_user_data();
     }
     //************************************ IS MANAGER
     $stringManager = false;
     $courseManagers = claro_get_course_manager_id($message->getCourseCode());
     $nbrOfManagers = count($courseManagers);
     for ($countManager = 0; $countManager < $nbrOfManagers; $countManager++) {
         if ($message->getSender() == $courseManagers[$countManager]) {
             $courseData = claro_get_course_data($message->getCourseCode());
             $stringManager = get_block('Course manager of %course%(%courseCode%)', array('%course%' => $courseData['name'], '%courseCode%' => $courseData['officialCode']));
         }
     }
     //---------------------- email subject
     $emailSubject = '[' . get_conf('siteName');
     if (!is_null($message->getCourseCode())) {
         $courseData = claro_get_course_data($message->getCourseCode());
         if ($courseData) {
             $emailSubject .= ' - ' . $courseData['officialCode'];
         }
     }
     $emailSubject .= '] ' . $message->getSubject();
     //------------------------------subject
     /* $altBody = get_lang('If you can\'t read this message go to: ') . rtrim( get_path('rootWeb'), '/' ) . '/claroline/messaging/readmessage.php?messageId=' . $messageId . '&type=received' . "\n\n"
        . '-- '
        . claro_get_current_user_data('lastName') . " " . claro_get_current_user_data('firstName') . "\n"
        . $stringManager
        . "\n\n" . get_conf('siteName') ." <" . get_conf('rootWeb') . '>' . "\n"
        . '   ' . get_lang('Administrator') . ' : ' . get_conf('administrator_name') . ' <' . get_conf('administrator_email') . '>' . "\n"
        ; */
     //-------------------------BODY
     $msgContent = claro_parse_user_text($message->getMessage());
     $urlAppend = get_path('url');
     if (!empty($urlAppend)) {
         $msgContent = preg_replace('!href="' . get_path('url') . '!', 'href="' . rtrim(get_path('rootWeb'), '/') . '/', $msgContent);
         $msgContent = preg_replace('!\\>' . get_path('url') . '!', '>' . get_path('rootWeb'), $msgContent);
     } else {
         $msgContent = preg_replace('!href="/!', 'href="' . rtrim(get_path('rootWeb'), '/') . '/', $msgContent);
     }
     $emailBody = "<html><head></head><body>" . $msgContent . '<br /><br />' . '-- <br />' . get_lang('%firstName %lastName', array('%firstName' => $userData['firstName'], '%lastName' => $userData['lastName'])) . "<br />" . $stringManager . '<br /><br /><a href="' . get_conf('rootWeb') . '">' . get_conf('siteName') . '</a><br />' . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . get_lang('Administrator') . ': <a href="mailto:' . get_conf('administrator_email') . '">' . get_conf('administrator_name') . '</a><br />' . '</body></html>';
     //******************************** END BODY
     //******************************************
     if (empty($userData['mail']) || !is_well_formed_email_address($userData['mail'])) {
         // do not send email for a user with no mail address
         pushClaroMessage('Mail Notification Failed : User has no email or an invalid one : ' . var_export($userData, true) . '!');
         return claro_failure::set_failure(get_lang("Mail Notification Failed : You don't have any email address defined in your user profile or the defined email address is not valid."));
     }
     self::emailNotification($userDataList, $emailBody, $emailSubject, $userData['mail'], get_lang('%firstName %lastName', array('%firstName' => $userData['firstName'], '%lastName' => $userData['lastName'])));
 }
Beispiel #17
0
    public function renderContent()
    {
        $output = '';
        $course = claro_get_current_course_data();
        $course['db'] = $course['dbName'];
        $toolId = get_tool_id_from_module_label('CLANN');
        if (is_module_installed_in_course('CLANN', claro_get_current_course_id()) && is_tool_activated_in_course($toolId, claro_get_current_course_id()) && claro_is_tool_visible($toolId, claro_get_current_course_id())) {
            $announcementList = announcement_get_course_item_list_portlet($course);
            // Manage announcement's datas
            if ($announcementList) {
                $output .= '<dl id="portletAnnouncements">' . "\n";
                $i = 0;
                foreach ($announcementList as $announcementItem) {
                    // Generate announcement URL
                    $announcementItem['url'] = get_path('url') . '/claroline/announcements/announcements.php?cidReq=' . $course['sysCode'];
                    // Generate announcement title and content
                    $announcementItem['title'] = trim(strip_tags($announcementItem['title']));
                    if ($announcementItem['title'] == '') {
                        $announcementItem['title'] = substr($announcementItem['title'], 0, 60) . (strlen($announcementItem['title']) > 60 ? ' (...)' : '');
                    }
                    $announcementItem['content'] = trim(strip_tags($announcementItem['content']));
                    if ($announcementItem['content'] == '') {
                        $announcementItem['content'] = substr($announcementItem['content'], 0, 60) . (strlen($announcementItem['content']) > 60 ? ' (...)' : '');
                    }
                    // Don't display hidden and expired elements
                    $isVisible = (bool) ($announcementItem['visibility'] == 'SHOW') ? 1 : 0;
                    $isOffDeadline = (bool) (isset($announcementItem['visibleFrom']) && strtotime($announcementItem['visibleFrom']) > time() || isset($announcementItem['visibleUntil']) && time() >= strtotime($announcementItem['visibleUntil'])) ? 1 : 0;
                    // Prepare the render
                    $displayChar = 250;
                    if (strlen($announcementItem['content']) > $displayChar) {
                        $content = substr($announcementItem['content'], 0, $displayChar) . '... <a href="' . claro_htmlspecialchars(Url::Contextualize($announcementItem['url'])) . '">' . '<b>' . get_lang('Read more &raquo;') . '</b></a>';
                    } else {
                        $content = $announcementItem['content'];
                    }
                    if ($isVisible && !$isOffDeadline) {
                        $output .= '<dt>' . "\n" . '<h2> ' . '<a href="' . $announcementItem['url'] . '#item' . $announcementItem['id'] . '">' . (!empty($announcementItem['title']) ? $announcementItem['title'] : get_lang('No title')) . '</a></h2>' . "\n" . '</dt>' . "\n" . '<dd' . ($i == count($announcementList) - 1 ? ' class="last"' : '') . '>' . "\n" . $content . "\n" . (claro_is_allowed_to_edit() ? '<div class="manageTools"><a
                                        href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLANN') . '/announcements.php?cmd=rqEdit&id=' . $announcementItem['id'])) . '"
                                        title="' . get_lang('Edit this item') . '">
                                        <img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" />
                                    </a>

                                    <a
                                        href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLANN') . '/announcements.php?cmd=exDelete&id=' . $announcementItem['id'])) . '"
                                        title="' . get_lang('Delete this item') . '">
                                        <img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />
                                    </a></div>' : '') . '</dd>' . "\n";
                    }
                    $i++;
                }
                $output .= '</dl>';
            } else {
                $output .= "\n" . '<dl>' . "\n" . '<dt></dt>' . "\n" . '<dd class="last">' . ' ' . get_lang('No announcement') . "\n" . '</dd>' . "\n" . '</dl>' . "\n\n";
            }
        }
        return $output;
    }
function _write_script_tags($files)
{
    foreach ($files as $file) {
        if (!preg_match('|\\.js$|', $file)) {
            $file = $file . '.js';
        }
        $path = get_path($file, 'js');
        print "<script src='{$path}' type='text/javascript'></script>\n";
    }
}
Beispiel #19
0
function is_xml($link = NULL)
{
    if ($link === NULL) {
        $link = $_SERVER['REQUEST_URI'];
    }
    if (preg_match('#.+\\.xml#', end(get_path($link)))) {
        return true;
    }
    return false;
}
Beispiel #20
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(PartnerCreateRequest $request)
 {
     $partner = new Partner();
     $partner->name = $request->get('name');
     $partner->link = $request->get('link');
     $partner->logo = get_path($request->get('image'));
     $partner->status = $request->get('status');
     $partner->save();
     return redirect()->route('admin.partner.index');
 }
Beispiel #21
0
 /**
  * Build the path and filename of the config file in version of claroline < 1.8
  *
  * @return string : complete path and name of config file
  */
 function build_old_config_filename()
 {
     if (!empty($this->conf_def['config_file'])) {
         // get the name of config file in definition file
         return get_path('incRepositorySys') . '/conf/' . $this->conf_def['config_file'];
     } else {
         // build the filename with the config_code
         return get_path('incRepositorySys') . '/conf/' . $this->config_code . '.conf.php';
     }
 }
Beispiel #22
0
function get_path($category_id)
{
    global $db;
    $result = $db->fetch_row_assoc("SELECT category_name, parent_id FROM " . config_item('cart', 'table_categories') . " WHERE category_id = '" . $category_id . "' ORDER BY category_name ASC");
    if ($result['parent_id']) {
        return get_path($result['parent_id']) . ' > ' . $result['category_name'];
    } else {
        return $result['category_name'];
    }
}
function convert_to_IMG($attachment, $options)
{
    $path = get_path($attachment);
    $dir = get_dir($attachment);
    $basename = get_basename($attachment);
    $converted_images = array();
    $max_width = $options['max_width'] ? (int) $options['max_width'] : 0;
    $max_height = $options['max_height'] ? (int) $options['max_height'] : 0;
    $img_extension = $options['img_extension'] ? $options['img_extension'] : 'jpg';
    $pages_to_convert = $options["pages_to_convert"] ? (int) $options["pages_to_convert"] : 0;
    if ($pages_to_convert > 5) {
        $pages_to_convert = 5;
    }
    $pages_to_convert = $pages_to_convert - 1;
    $quality = $options['quality'] ? (int) $options['quality'] : 80;
    if ($quality > 100) {
        $quality = 100;
    }
    try {
        $imagick = new Imagick();
        $imagick->clear();
        $imagick->destroy();
        if ($options) {
            $imagick->setResolution(150, 150);
            $imagick->readimage($path);
            $imagick->setCompressionQuality($quality);
        } else {
            $imagick->setResolution(72, 72);
            $imagick->readimage($path);
        }
        foreach ($imagick as $c => $_page) {
            if ($pages_to_convert == -1 || $c <= $pages_to_convert) {
                $_page->setImageBackgroundColor('white');
                $_page->setImageFormat($img_extension);
                if ($max_width && $max_height) {
                    $_page->adaptiveResizeImage($max_width, $max_height, true);
                }
                $blankPage = new \Imagick();
                $blankPage->newPseudoImage($_page->getImageWidth(), $_page->getImageHeight(), "canvas:white");
                $blankPage->compositeImage($_page, \Imagick::COMPOSITE_OVER, 0, 0);
                if ($blankPage->writeImage($dir . "/" . $basename . '-' . $c . '.' . $img_extension)) {
                    array_push($converted_images, $dir . "/" . $basename . '-' . $c . '.' . $img_extension);
                }
                $blankPage->clear();
                $blankPage->destroy();
            }
        }
    } catch (ImagickException $e) {
        $converted_images = false;
    } catch (Exception $e) {
        $converted_images = false;
    }
    return $converted_images;
}
Beispiel #24
0
 function get_path($node)
 {
     $sql = "select * from xyun_newstype where typeid={$node};";
     $result = $this->db->query($sql);
     $row = $this->db->fetch_array($result);
     $path = array();
     if ($row['parentid'] != '0') {
         $path[] = $row['typename'];
         $path = array_merge(get_path($row['parentid']), $path);
     }
     return $path;
 }
 public static function ProfilePermaLink($id, $name = null, $subsite = null)
 {
     if ($name == null) {
         self::_load($id);
         $name = self::$_cache["username"];
     }
     $name2 = str_replace(array(" ", "#"), array("_", ""), $name);
     if ($subsite != null) {
         return get_path("/users/" . $id . "/" . html($name2) . "/" . $subsite);
     }
     return get_path("/users/" . $id . "/" . urlencode($name2));
 }
Beispiel #26
0
function get_item($item)
{
    switch ($item->getName()) {
        case 'path':
            return get_path($item);
            break;
        case 'rect':
            return get_rect($item);
            break;
        default:
            echo 'WARNING: unrecognised element - ' . $item->getName();
            break;
    }
}
Beispiel #27
0
function get_header()
{
    $path = get_path();
    return '<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>IT2805 - Jim Frode Hoff</title>

		<!-- Bootstrap CSS -->
		<!-- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> -->
		<link rel="stylesheet" media="screen" href="' . $path . '/css/style.css">

	</head>';
}
Beispiel #28
0
 public function getActive($recursive = false)
 {
     $p = empty($_GET['p']) ? trim(get_path(), '/') : str_replace('./', '/', $_GET['p']);
     if (!$p) {
         $p = 'home';
     }
     if (!empty($_GET['p']) && file_exists(TEMPLATEPATH . '/pages/' . $p . '.php')) {
         return $p;
     }
     foreach ($this->arr as $key => $link) {
         if ($a = $link->isActive($p)) {
             return $recursive ? $a : $p;
         }
     }
     return 'home';
 }
Beispiel #29
0
 public function getFilePath($requestedUrl)
 {
     if (claro_is_in_a_course()) {
         $intermediatePath = get_path('coursesRepositorySys') . claro_get_course_path() . '/document';
     } else {
         $intermediatePath = rtrim(str_replace('\\', '/', get_path('rootSys')), '/') . '/platform/document';
     }
     if (get_conf('secureDocumentDownload') && $GLOBALS['is_Apache']) {
         // pretty url
         $path = realpath($intermediatePath . '/' . $requestedUrl);
     } else {
         // TODO check if we can remove rawurldecode
         $path = $intermediatePath . implode('/', array_map('rawurldecode', explode('/', $requestedUrl)));
     }
     return $path;
 }
Beispiel #30
0
function print_screen($current_plugin_version)
{
    $latest_tp_plugin_version = 'sm-2a_' . get_latest_plugin_version();
    $mobiquo_path = get_path();
    $check_upload_status = file_get_contents("http://" . $mobiquo_path . "/upload.php?checkAccess");
    $check_push_status = file_get_contents("http://" . $mobiquo_path . "/push.php?checkAccess");
    require_once dirname(dirname(__FILE__)) . '/SSI.php';
    global $modSettings;
    echo "Forum XMLRPC Interface for Tapatalk Application<br><br>";
    //echo "Forum system version:".$modSettings['smfVersion']."<br>";
    echo "Current Tapatalk plugin version: " . $current_plugin_version . "<br>";
    echo "Latest Tapatalk plugin version: <a href=\"https://tapatalk.com/activate_tapatalk.php?plugin=smf\" target=\"_blank\">" . $latest_tp_plugin_version . "</a><br>";
    echo "Attachment upload interface status: <a href=\"http://" . $mobiquo_path . "/upload.php\" target=\"_blank\">" . ($check_upload_status ? 'OK' : 'Inaccessible') . "</a><br>";
    echo "Push notification interface status: <a href=\"http://" . $mobiquo_path . "/push.php\" target=\"_blank\">" . ($check_push_status ? 'OK' : 'Inaccessible') . "</a><br>";
    echo "<br>\n<a href=\"http://tapatalk.com/api.php\" target=\"_blank\">Tapatalk API for Universal Forum Access</a><br>\nFor more details, please visit <a href=\"http://tapatalk.com\" target=\"_blank\">http://tapatalk.com</a>";
}