Пример #1
0
function get_announcements_block()
{
    $buffer = '';
    if (is_user_granted_permission(PERM_ADMIN_ANNOUNCEMENTS)) {
        // include a login warning if user password and email are still the defaults
        if (get_opendb_session_var('user_id') == 'admin') {
            $announcements_rs = get_admin_announcements_rs();
            while (list(, $announcement_r) = each($announcements_rs)) {
                $buffer .= "<li><h4>" . $announcement_r['heading'] . "</h4>\n\t\t\t\t\t<p class=\"content\">" . $announcement_r['message'] . "<a class=\"adminLink\" href=\"" . $announcement_r['link'] . "\">" . $announcement_r['link_text'] . "</a></p>";
            }
        }
    }
    if (get_opendb_config_var('welcome.announcements', 'enable') !== FALSE && is_user_granted_permission(PERM_VIEW_ANNOUNCEMENTS)) {
        $results = fetch_announcement_rs('submit_on', 'DESC', 0, get_opendb_config_var('welcome.announcements', 'display_count'), 'Y', 'Y');
        if ($results) {
            while ($announcement_r = db_fetch_assoc($results)) {
                $buffer .= "<li><h4>" . $announcement_r['title'] . "</h4>";
                $buffer .= "<small class=\"submitDate\">" . get_localised_timestamp(get_opendb_config_var('welcome.announcements', 'datetime_mask'), $announcement_r['submit_on']) . "</small>";
                $buffer .= "<p class=\"content\">" . nl2br($announcement_r['content']) . "</p></li>";
            }
            db_free_result($results);
        }
    }
    if (strlen($buffer) > 0) {
        return "\n<div id=\"announcements\">" . "<h3>" . get_opendb_lang_var('announcements') . "</h3>" . "\n<ul>" . $buffer . "\n</ul></div>";
    } else {
        return NULL;
    }
}
Пример #2
0
                                     $checkbox_action_rs[] = array('action' => 'item_borrow.php', 'op' => 'check_out', link => get_opendb_lang_var('check_out_item(s)'));
                                     $checkbox_action_rs[] = array('action' => 'item_borrow.php', 'op' => 'cancel_reserve', link => get_opendb_lang_var('cancel_reservation(s)'));
                                 }
                             }
                         }
                     }
                     echo format_checkbox_action_links('sequence_number', get_opendb_lang_var('no_items_checked'), $checkbox_action_rs);
                 }
                 echo format_help_block($listingObject->getHelpEntries());
                 echo "<ul class=\"listingControls\">";
                 if (get_opendb_config_var('listings', 'allow_override_show_item_image') !== FALSE) {
                     echo "<li>" . getToggleControl($PHP_SELF, $HTTP_VARS, get_opendb_lang_var('show_item_image'), 'show_item_image', ifempty($HTTP_VARS['show_item_image'], get_opendb_config_var('listings', 'show_item_image') == TRUE ? 'Y' : 'N')) . "</li>";
                 }
                 echo "<li>" . getItemsPerPageControl($PHP_SELF, $HTTP_VARS) . "</li>";
                 echo "</ul>";
                 echo "<p class=\"listingDate\">" . get_opendb_lang_var('listing_generated', 'datetime', get_localised_timestamp(get_opendb_config_var('listings', 'print_listing_datetime_mask'))) . "</p>";
                 echo format_footer_links($footer_links_r);
                 echo _theme_footer();
             }
             //end if($show_listings)
         } else {
             //no guests allowed!
             opendb_not_authorised_page(PERM_USER_BORROWER, $HTTP_VARS);
         }
     } else {
         //borrow functionality disabled.
         echo _theme_header(get_opendb_lang_var('borrow_not_supported'));
         echo "<p class=\"error\">" . get_opendb_lang_var('borrow_not_supported') . "</p>";
         echo _theme_footer();
     }
 } else {
Пример #3
0
     echo "<p>Importing " . $HTTP_VARS['import_file'] . "...</p>";
     $jobObj->printJobProgressBar($HTTP_VARS['import_file']);
 } else {
     //if(strlen($HTTP_VARS['import_file'])>0)
     echo "\n<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=list_site_plugins\">Back to Main</a>]</p>";
     echo "\n<h3>" . $site_plugin_r['title'] . " Installation Maintenance</h3>";
     $classname = "Install_" . $HTTP_VARS['site_type'];
     include_once "./admin/s_site_plugin/sql/" . $HTTP_VARS['site_type'] . ".install.class.php";
     $installPlugin = new $classname();
     $recordCount = $installPlugin->getRecordCount();
     if (is_numeric($recordCount)) {
         echo "\n<p>Record Count: " . $recordCount . "</p>";
     }
     $lastUpdated = $installPlugin->getLastUpdated();
     if ($lastUpdated !== FALSE) {
         $lastUpdatedString = get_localised_timestamp($cfg_date_mask, $lastUpdated);
     }
     if (strlen($lastUpdated) > 0) {
         echo "\n<p>Last updated: " . $lastUpdatedString . "</p>";
     }
     echo "\n<h4>Listing <code>./admin/s_site_plugin/upload/</code> directory</h4>";
     echo "\n<table>";
     echo "\n<tr class=\"navbar\">" . "<th>CSV File</th>" . "<th>Action</th>" . "\n</tr>";
     $file_list_r = get_file_list('./admin/s_site_plugin/upload/', 'csv');
     if (is_not_empty_array($file_list_r)) {
         $toggle = TRUE;
         reset($file_list_r);
         while (list(, $file) = each($file_list_r)) {
             $color = $toggle ? "oddRow" : "evenRow";
             $toggle = !$toggle;
             echo "\n<form name=\"import_file\" action=\"{$PHP_SELF}\" method=\"GET\">" . "\n<input type=\"hidden\" name=\"type\" value=\"" . $ADMIN_TYPE . "\">" . "\n<input type=\"hidden\" name=\"site_type\" value=\"" . $HTTP_VARS['site_type'] . "\">" . "\n<input type=\"hidden\" name=\"op\" value=\"" . $HTTP_VARS['op'] . "\">" . "\n<input type=\"hidden\" name=\"import_file\" value=\"" . $file . "\">";
Пример #4
0
 function queryItem($search_attributes_r, $s_item_type)
 {
     $hometheaterinfo_r = fetch_hometheaterinfo_r($search_attributes_r['hmi_id']);
     if ($hometheaterinfo_r !== FALSE) {
         // Format slash correctly.
         $hometheaterinfo_r['title'] = str_replace("/ ", " / ", $hometheaterinfo_r['title']);
         // Lets get anything in brackets out into DVD_EXTRAS field.
         $indexStart = strpos($hometheaterinfo_r['title'], "(");
         if ($indexStart !== FALSE && $indexStart > 0) {
             // In case bracket is first character!!!
             $indexEnd = strpos($hometheaterinfo_r['title'], ")", $indexStart);
             if ($indexEnd !== FALSE) {
                 $this->addItemAttribute('dvd_extras', substr($hometheaterinfo_r['title'], $indexStart + 1, $indexEnd - ($indexStart + 1)));
                 $this->addItemAttribute('title', substr($hometheaterinfo_r['title'], 0, $indexStart));
             } else {
                 $this->addItemAttribute('title', $hometheaterinfo_r['title']);
             }
         } else {
             $this->addItemAttribute('title', $hometheaterinfo_r['title']);
         }
         if (strlen($hometheaterinfo_r['studio']) > 0) {
             $this->addItemAttribute('studio', $hometheaterinfo_r['studio']);
         }
         if (strlen($hometheaterinfo_r['rel_status']) > 0) {
             $this->addItemAttribute('rel_status', $hometheaterinfo_r['rel_status']);
         }
         $this->addItemAttribute('dvd_region', '1');
         // This is only option!
         // All Region 1 (US) items should be NTSC!
         $this->addItemAttribute('vid_format', 'NTSC');
         //------------------
         // AUDIO_LANG Processing.
         //------------------
         //1.0, 2.0, 4.0, 5.0, 5.1, DTS, 6.1 ES, 6.1 EX, SUR, PCM,DUB, SUB, SIL, VAR
         $this->addItemAttribute('audio_lang', $hometheaterinfo_r['audio_lang']);
         //------------------
         // DVD_FORMAT Processing.
         //------------------
         if (strlen($hometheaterinfo_r['dvd_format']) > 0) {
             $dvd_format_r = trim_explode(',', $hometheaterinfo_r['dvd_format']);
             while (list(, $dvd_format) = each($dvd_format_r)) {
                 switch ($dvd_format) {
                     case 'LBX':
                         $this->addItemAttribute('dvd_format', 'LBX');
                         break;
                     case '4:3':
                         $this->addItemAttribute('dvd_format', '4:3');
                         break;
                     case '16:9':
                         $this->addItemAttribute('dvd_format', '16:9');
                         $this->addItemAttribute('anamorphic', 'Y');
                         break;
                     case 'P&S':
                         $this->addItemAttribute('dvd_format', 'P&S');
                         break;
                         //case 'VAR':
                         //	break;
                     //case 'VAR':
                     //	break;
                     default:
                         // serves as UNK as well.
                         break;
                 }
                 // switch$record['dvd_format']
             }
         }
         //------------------
         // RATIO Processing.
         //------------------
         if (strlen($hometheaterinfo_r['ratio']) > 0) {
             if ($hometheaterinfo_r['ratio'] != "VAR") {
                 $indexOfColon = strpos($hometheaterinfo_r['ratio'], ":");
                 // Remove everything after the colon.
                 if ($indexOfColon !== FALSE) {
                     $this->addItemAttribute('ratio', substr($hometheaterinfo_r['ratio'], 0, $indexOfColon));
                 }
             }
         }
         //------------------
         // PRICE Processing.
         //------------------
         if (strlen($hometheaterinfo_r['listprice']) > 0) {
             if (substr($hometheaterinfo_r['listprice'], 0, 1) == "\$") {
                 $this->addItemAttribute('listprice', substr($hometheaterinfo_r['listprice'], 1));
             }
         }
         //------------------
         // YEAR Processing.
         //------------------
         if (is_numeric($hometheaterinfo_r['year'])) {
             $this->addItemAttribute('year', $hometheaterinfo_r['year']);
         }
         //------------------
         // GENRE Processing.
         //------------------
         if (strlen($hometheaterinfo_r['genre']) > 0) {
             if ($hometheaterinfo_r['genre'] != "VAR") {
                 // Remove spaces and explode on /
                 $genre_r = explode("/", str_replace(" ", "", $hometheaterinfo_r['genre']));
                 $this->addItemAttribute('genre', $genre_r);
             }
         }
         //------------------
         // DATE Processing.
         // Note: Ignores any hours/minutes/seconds
         //------------------
         $date_format_cfg = $this->getConfigValue('datetime_mask');
         // We will change the date format to use later on!
         if (strlen($hometheaterinfo_r['dvd_rel_dt']) > 0) {
             //YYYY-MM-DD
             list($year, $month, $day) = sscanf($hometheaterinfo_r['dvd_rel_dt'], "%d-%d-%d");
             $this->addItemAttribute('dvd_rel_dt', get_localised_timestamp($date_format_cfg, mktime(0, 0, 0, $month, $day, $year)));
         }
         // We will change the date format to use later on!
         if (strlen($hometheaterinfo_r['orig_rel_dt']) > 0) {
             //YYYY-MM-DD
             list($year, $month, $day) = sscanf($hometheaterinfo_r['orig_rel_dt'], "%d-%d-%d");
             $this->addItemAttribute('orig_rel_dt', get_localised_timestamp($date_format_cfg, mktime(0, 0, 0, $month, $day, $year)));
         }
         if (strlen($hometheaterinfo_r['age_rating']) > 0) {
             $this->addItemAttribute('age_rating', $hometheaterinfo_r['age_rating']);
         }
         if (strlen($hometheaterinfo_r['upc_id']) > 0) {
             $this->addItemAttribute('upc_id', $hometheaterinfo_r['upc_id']);
         }
         return TRUE;
     } else {
         //if($hometheaterinfo_r!==FALSE)
         return FALSE;
     }
 }
Пример #5
0
    if ($results) {
        while ($file_cache_r = db_fetch_assoc($results)) {
            $listingObject->startRow();
            if (file_cache_get_cache_file($file_cache_r)) {
                $popupUrl = "url.php?id=" . $file_cache_r['sequence_number'];
                $listingObject->addColumn("<a href=\"" . $file_cache_r['url'] . "\" onclick=\"popup('{$popupUrl}'); return false;\" target=\"_new\">" . get_overflow_tooltip_column($file_cache_r['url'], 100) . "</a>");
            } else {
                $listingObject->addColumn(get_overflow_tooltip_column($file_cache_r['url'], 100));
            }
            $listingObject->addColumn(get_localised_timestamp(get_opendb_config_var('http', 'datetime_mask'), $file_cache_r['cache_date']));
            $column = '';
            if ($file_cache_r['expired_ind'] == 'Y') {
                $column .= "<span class=\"error\">";
            }
            if ($file_cache_r['expire_date'] != NULL) {
                $column .= get_localised_timestamp(get_opendb_config_var('http', 'datetime_mask'), $file_cache_r['expire_date']);
            } else {
                $column .= "NA";
            }
            if ($file_cache_r['expired_ind'] == 'Y') {
                $column .= "</span>";
            }
            $listingObject->addColumn($column);
            $listingObject->endRow();
        }
        //while
        db_free_result($results);
    }
    $listingObject->endListing();
    unset($listingObject);
}
 function item_attribute($s_attribute_type, $order_no, $attribute_val)
 {
     if ($s_attribute_type == 'IMDB_ID') {
         if ($this->imdbUrl != NULL) {
             $this->attribute_rs['URL'] = str_replace('{imdb_id}', $attribute_val, $this->imdbUrl);
         }
     } else {
         if ($s_attribute_type == 'MOVIEGENRE') {
             $this->attribute_rs['Genre'][] = $attribute_val;
         } else {
             if ($s_attribute_type == 'ACTORS') {
                 $this->attribute_rs['Actor'][] = $attribute_val;
             } else {
                 if ($s_attribute_type == 'DIRECTOR') {
                     $this->attribute_rs['Director'][] = $attribute_val;
                 } else {
                     if ($s_attribute_type == 'IMAGEURL') {
                         //  || $s_attribute_type == 'IMAGEURLB'
                         $this->attribute_rs['Cover'] = $attribute_val;
                     } else {
                         if ($s_attribute_type == 'PUR_DATE') {
                             $timestamp = get_timestamp_for_datetime($attribute_val, 'YYYYMMDDHH24MISS');
                             $this->attribute_rs['PurchaseDate'] = get_localised_timestamp('YYYYMMDDTT00:00:00', $timestamp);
                         } else {
                             if ($s_attribute_type == 'DVD_REGION') {
                                 // this is a giant hack!
                                 switch ($attribute_val) {
                                     case '2':
                                         $this->attribute_rs['Country'] = 'United Kingdom';
                                         break;
                                     case '4':
                                         $this->attribute_rs['Country'] = 'Australia';
                                         break;
                                     case '1':
                                     default:
                                         $this->attribute_rs['Country'] = 'United States';
                                 }
                             } else {
                                 if (isset($this->attribute_map[$s_attribute_type])) {
                                     $key = $this->attribute_map[$s_attribute_type];
                                     $this->attribute_rs[$key] = $attribute_val;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // return nothing yet as we will wrap it all up in end_item
     return NULL;
 }
Пример #7
0
function get_datetime_value($value, $format_mask = "", $auto_datetime = "")
{
    if (strlen($value) > 0) {
        // the timestamp is stored in the database with the format YYYYMMDDHH24MISS
        $timestamp = get_timestamp_for_datetime($value, 'YYYYMMDDHH24MISS');
        if ($timestamp !== FALSE) {
            if (strlen($format_mask) == 0) {
                $format_mask = 'DD/MM/YYYY';
            }
            $datetime = get_localised_timestamp($format_mask, $timestamp);
            if ($datetime === FALSE) {
                $datetime = $value;
                // as a last resort
            }
        } else {
            $datetime = $value;
            // as a last resort
        }
    } else {
        if ($value === NULL && strcasecmp($auto_datetime, 'Y') === 0) {
            $datetime = get_localised_timestamp($format_mask);
            // current date
        } else {
            $datetime = '';
        }
    }
    return $datetime;
}
Пример #8
0
    return TRUE;
}
if ($HTTP_VARS['op'] == 'export') {
    @set_time_limit(600);
    header("Cache-control: no-store");
    header("Pragma: no-store");
    header("Expires: 0");
    header("Content-disposition: attachment; filename=backup.sql");
    header("Content-type: application/octet-stream");
    $CRLF = get_user_browser_crlf();
    echo "# -------------------------------------------------------------" . $CRLF;
    echo "# " . get_opendb_title_and_version() . $CRLF;
    echo "# https://github.com/pellcorp/opendb" . $CRLF;
    echo "#" . $CRLF;
    echo "# " . get_opendb_lang_var('connected_to', get_opendb_config_var('db_server')) . $CRLF;
    echo "# " . get_opendb_lang_var('db_backup_generated', 'date', get_localised_timestamp(get_opendb_config_var('listings', 'print_listing_datetime_mask'))) . $CRLF;
    echo "# -------------------------------------------------------------" . $CRLF;
    // special all tables option reset $HTTP_VARS['tables'] array as a result
    if (strcasecmp($HTTP_VARS['all_tables'], 'y') === 0) {
        unset($HTTP_VARS['tables']);
        $opendb_tables_r = fetch_opendb_table_list_r();
        while (list(, $value) = each($opendb_tables_r)) {
            $HTTP_VARS['tables'][] = $value;
        }
    }
    @reset($HTTP_VARS['tables']);
    while (list(, $table) = @each($HTTP_VARS['tables'])) {
        echo $CRLF . "#" . $CRLF;
        echo "# " . get_opendb_lang_var('dumping_data_for_table', 'table', $table) . $CRLF;
        echo "#" . $CRLF . $CRLF;
        get_table_content($table, $CRLF);
Пример #9
0
/**
	@selected will be currently selected record.

	$borrow_duration is the item_instance.borrow_duration value in all cases, the rest of the values to do
	with borrow duration will be calculated.
*/
function get_item_status_row($class, $item_r, $selected)
{
    global $HTTP_VARS;
    global $PHP_SELF;
    global $titleMaskCfg;
    $rowcontents = "\n<tr class=\"{$class}\"><td";
    if ($selected) {
        $rowcontents .= " class=\"currentItemInstance\">" . $item_r['instance_no'] . "</span>";
    } else {
        $rowcontents .= "><a href=\"{$PHP_SELF}?item_id={$item_r['item_id']}&instance_no={$item_r['instance_no']}\">" . $item_r['instance_no'] . "</a>";
    }
    $rowcontents .= "\n</td>";
    $page_title = $titleMaskCfg->expand_item_title($item_r);
    $page_title = remove_enclosing_quotes($page_title);
    $rowcontents .= "<td>" . get_list_username($item_r['owner_id'], $HTTP_VARS['mode'], $page_title, get_opendb_lang_var('back_to_item'), 'item_display.php?item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no']) . "</td>";
    $status_type_r = fetch_status_type_r($item_r['s_status_type']);
    // ---------------------- Borrow,Reserve,Cancel,Edit,Delete,etc operations here.
    $action_links_rs = NULL;
    if (is_user_granted_permission(PERM_ITEM_OWNER) && get_opendb_session_var('user_id') === $item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) {
        $action_links_rs[] = array(url => 'item_input.php?op=edit&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'edit.gif', text => get_opendb_lang_var('edit'));
        // Checks if any legal site plugins defined for $item_r['s_item_type']
        if (is_item_legal_site_type($item_r['s_item_type'])) {
            $action_links_rs[] = array(url => 'item_input.php?op=site-refresh&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'refresh.gif', text => get_opendb_lang_var('refresh'));
        }
        if ($status_type_r['delete_ind'] == 'Y' && !is_item_reserved_or_borrowed($item_r['item_id'], $item_r['instance_no'])) {
            $action_links_rs[] = array(url => 'item_input.php?op=delete&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'delete.gif', text => get_opendb_lang_var('delete'));
        }
    }
    if (is_user_granted_permission(array(PERM_USER_BORROWER, PERM_ADMIN_BORROWER))) {
        if (get_opendb_config_var('borrow', 'enable') !== FALSE) {
            if (get_opendb_config_var('borrow', 'quick_checkout') !== FALSE && $status_type_r['borrow_ind'] == 'Y' && is_user_allowed_to_checkout_item($item_r['item_id'], $item_r['instance_no'])) {
                if (!is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) {
                    $action_links_rs[] = array(url => 'item_borrow.php?op=quick_check_out&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'quick_check_out.gif', text => get_opendb_lang_var('quick_check_out'));
                }
            }
            // Check if already in reservation session variable.
            if (get_opendb_config_var('borrow', 'reserve_basket') !== FALSE && is_item_in_reserve_basket($item_r['item_id'], $item_r['instance_no'])) {
                $action_links_rs[] = array(url => 'borrow.php?op=delete_from_my_reserve_basket&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'delete_reserve_basket.gif', text => get_opendb_lang_var('delete_from_reserve_list'));
            } else {
                if (is_item_reserved_or_borrowed($item_r['item_id'], $item_r['instance_no'])) {
                    if (is_item_reserved_by_user($item_r['item_id'], $item_r['instance_no'])) {
                        $action_links_rs[] = array(url => 'item_borrow.php?op=cancel_reserve&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'cancel_reserve.gif', text => get_opendb_lang_var('cancel_reservation'));
                    } else {
                        if (!is_item_borrowed_by_user($item_r['item_id'], $item_r['instance_no'])) {
                            if ($status_type_r['borrow_ind'] == 'Y' && (get_opendb_config_var('borrow', 'allow_reserve_if_borrowed') !== FALSE || !is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) && (get_opendb_config_var('borrow', 'allow_multi_reserve') !== FALSE || !is_item_reserved($item_r['item_id'], $item_r['instance_no']))) {
                                if (get_opendb_config_var('borrow', 'reserve_basket') !== FALSE) {
                                    $action_links_rs[] = array(url => 'borrow.php?op=update_my_reserve_basket&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'add_reserve_basket.gif', text => get_opendb_lang_var('add_to_reserve_list'));
                                } else {
                                    $action_links_rs[] = array(url => 'item_borrow.php?op=reserve&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'reserve_item.gif', text => get_opendb_lang_var('reserve_item'));
                                }
                            }
                        }
                    }
                } else {
                    if ($status_type_r['borrow_ind'] == 'Y') {
                        if (get_opendb_config_var('borrow', 'reserve_basket') !== FALSE) {
                            $action_links_rs[] = array(url => 'borrow.php?op=update_my_reserve_basket&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'add_reserve_basket.gif', text => get_opendb_lang_var('add_to_reserve_list'));
                        } else {
                            $action_links_rs[] = array(url => 'item_borrow.php?op=reserve&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'reserve_item.gif', text => get_opendb_lang_var('reserve_item'));
                        }
                    }
                }
            }
        }
    }
    if (is_item_borrowed($item_r['item_id'], $item_r['instance_no']) && is_user_allowed_to_checkin_item($item_r['item_id'], $item_r['instance_no'])) {
        $action_links_rs[] = array(url => 'item_borrow.php?op=check_in&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'check_in_item.gif', text => get_opendb_lang_var('check_in_item'));
    }
    if ($item_r['owner_id'] == get_opendb_session_var('user_id') || is_user_granted_permission(PERM_ADMIN_BORROWER)) {
        if (is_exists_item_instance_history_borrowed_item($item_r['item_id'], $item_r['instance_no'])) {
            $action_links_rs[] = array(url => 'borrow.php?op=my_item_history&item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'], img => 'item_history.gif', text => get_opendb_lang_var('item_history'));
        }
    }
    $rowcontents .= "\n<td>";
    $rowcontents .= ifempty(format_action_links($action_links_rs), get_opendb_lang_var('not_applicable'));
    $rowcontents .= "</td>";
    // Item Status Image.
    $rowcontents .= "\n<td>";
    $rowcontents .= theme_image($status_type_r['img'], $status_type_r['description'], "s_status_type");
    $rowcontents .= "</td>";
    // If a comment is allowed and defined, add it in.
    $rowcontents .= "\n<td>";
    if ($status_type_r['status_comment_ind'] == 'Y' || get_opendb_session_var('user_id') === $item_r['owner_id'] || is_user_granted_permission(PERM_ITEM_ADMIN)) {
        $rowcontents .= ifempty(nl2br($item_r['status_comment']), "&nbsp;");
        // support newlines in this field
    } else {
        $rowcontents .= get_opendb_lang_var('not_applicable');
    }
    $rowcontents .= "</td>";
    if (get_opendb_config_var('borrow', 'enable') !== FALSE) {
        if (get_opendb_config_var('borrow', 'include_borrower_column') !== FALSE) {
            $rowcontents .= "\n<td>";
            if (is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) {
                $rowcontents .= get_list_username(fetch_item_borrower($item_r['item_id'], $item_r['instance_no']), NULL, $page_title, get_opendb_lang_var('back_to_item'), 'item_display.php?item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no']);
            } else {
                $rowcontents .= get_opendb_lang_var('not_applicable');
            }
            $rowcontents .= "</td>";
        }
        // Borrow Status Image.
        $rowcontents .= "\n<td>";
        if (is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) {
            $rowcontents .= theme_image("borrowed.gif", get_opendb_lang_var('borrowed'), "borrowed_item");
        } else {
            if (is_item_reserved($item_r['item_id'], $item_r['instance_no'])) {
                $rowcontents .= theme_image("reserved.gif", get_opendb_lang_var('reserved'), "borrowed_item");
            } else {
                $rowcontents .= get_opendb_lang_var('not_applicable');
            }
        }
        $rowcontents .= "</td>";
        if (get_opendb_config_var('borrow', 'duration_support') !== FALSE) {
            // 'Due Back' functionality.
            $rowcontents .= "\n<td>";
            if (is_item_borrowed($item_r['item_id'], $item_r['instance_no'])) {
                $due_date = fetch_item_duedate_timestamp($item_r['item_id'], $item_r['instance_no']);
                if (strlen($due_date) > 0) {
                    $rowcontents .= get_localised_timestamp(get_opendb_config_var('borrow', 'date_mask'), $due_date);
                } else {
                    $rowcontents .= get_opendb_lang_var('undefined');
                }
            } else {
                if (is_numeric($item_r['borrow_duration'])) {
                    $duration_attr_type_r = fetch_sfieldtype_item_attribute_type_r($item_r['s_item_type'], 'DURATION');
                    $rowcontents .= get_item_display_field($item_r, $duration_attr_type_r, $item_r['borrow_duration'], FALSE);
                } else {
                    $rowcontents .= get_opendb_lang_var('undefined');
                }
            }
            $rowcontents .= "</td>";
        }
    }
    $rowcontents .= "\n</tr>";
    return $rowcontents;
}
Пример #10
0
}
if ($HTTP_VARS['op'] == 'list') {
    echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=new\">New Announcement</a>]</p>";
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }
    $result = fetch_announcement_rs();
    if ($result) {
        $submitted_datetime_mask = get_opendb_config_var('welcome.announcements', 'datetime_mask');
        echo "<table>";
        echo "<tr class=\"navbar\">" . "<th>Title</th>" . "<th>Content</th>" . "<th>Submitted</th>" . "<th>Display Days</th>" . "<th>Closed</th>" . "<th></th>" . "</tr>";
        while ($announcement_r = db_fetch_assoc($result)) {
            echo "<tr>";
            echo "\n<td class=\"data\">" . $announcement_r['title'] . "";
            echo "\n<td class=\"data\">" . nl2br($announcement_r['content']) . "</td>";
            echo "<td class=\"data\">" . get_localised_timestamp($submitted_datetime_mask, $announcement_r['submit_on']) . '</td>' . "<td class=\"data\">" . $announcement_r['display_days'] . '</td>' . "<td class=\"data\">" . $announcement_r['closed_ind'] . '</td>';
            echo "<td class=\"data\"><a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=edit&announcement_id=" . $announcement_r['sequence_number'] . "\">Edit</a>";
            echo " / <a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=delete&announcement_id=" . $announcement_r['sequence_number'] . "\">Delete</a></td>";
            echo "</tr>";
        }
        db_free_result($result);
        echo "</table>";
    } else {
        //if($result)
        echo "\n<p class=\"error\">No Announcements Found</p>";
    }
} else {
    if ($HTTP_VARS['op'] == 'new') {
        //display new announcement form.
        echo "<p>[<a href=\"{$PHP_SELF}?type={$ADMIN_TYPE}&op=list\">Back to Main</a>]</p>";
        echo "<h3>New Announcement</h3>";
Пример #11
0
function get_item_display_field($item_r, $item_attribute_type_r, $value = NULL, $dowrap = TRUE, $prompt_mask = NULL)
{
    if ($item_attribute_type_r['display_type'] == 'hidden') {
        return '';
    } else {
        if ($item_attribute_type_r['display_type'] == 'fileviewer') {
            $format_mask = ifempty($item_attribute_type_r['display_type_arg1'], '%value%');
            $width = ifempty($item_attribute_type_r['display_type_arg2'], '400');
            $height = ifempty($item_attribute_type_r['display_type_arg3'], '300');
            $target = ifempty($item_attribute_type_r['display_type_arg4'], '_blank');
            if (is_array($value)) {
                $values = $value;
            } else {
                $values[] = $value;
            }
            if (count($values) > 0) {
                $display_value_r = array();
                while (list(, $value) = each($values)) {
                    $value = trim($value);
                    $value_format_mask = $format_mask;
                    if (strpos($value_format_mask, '%img%') !== FALSE) {
                        $file_type_r = fetch_file_type_r(fetch_file_type_for_extension(get_file_ext($value)));
                        if (strlen($file_type_r['image']) > 0 && ($image_src = theme_image_src($file_type_r['image'])) !== FALSE) {
                            $img = '<img src="' . $image_src . '" title="' . $value . '">';
                        } else {
                            $img = '';
                        }
                        $value_format_mask = str_replace('%img%', $img, $value_format_mask);
                    }
                    if (strpos($value_format_mask, '%value%') !== FALSE) {
                        $value_format_mask = str_replace('%value%', $value, $value_format_mask);
                    }
                    $file_r = file_cache_get_image_r($value, 'display');
                    $url = $file_r['fullsize']['url'];
                    $display_value_r[] = "<a href=\"" . $value . "\" onclick=\"fileviewer('{$url}' ,'" . ($width + 20) . "', '" . ($height + 25) . "', '" . $target . "'); return false;\" title=\"" . $item_attribute_type_r['prompt'] . "\" class=\"popuplink\">{$value_format_mask}</a>";
                }
                $field = format_multivalue_block($display_value_r, 'fileviewer');
                if ($dowrap) {
                    return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                } else {
                    return $field;
                }
            } else {
                return '';
            }
        } else {
            if ($item_attribute_type_r['display_type'] == 'datetime') {
                if (is_array($value)) {
                    $values = $value;
                } else {
                    $values[] = $value;
                }
                if (count($values) > 0) {
                    $display_value_r = array();
                    while (list(, $value) = each($values)) {
                        $value = trim($value);
                        $timestamp = get_timestamp_for_datetime($value, 'YYYYMMDDHH24MISS');
                        if ($timestamp !== FALSE) {
                            if (strlen($item_attribute_type_r['display_type_arg1']) == 0) {
                                $item_attribute_type_r['display_type_arg1'] = 'DD/MM/YYYY';
                            }
                            $datetime = get_localised_timestamp($item_attribute_type_r['display_type_arg1'], $timestamp);
                            if ($datetime !== FALSE) {
                                $display_value_r[] = $datetime;
                            } else {
                                $display_value_r[] = $value;
                            }
                        } else {
                            $display_value_r[] = $value;
                        }
                    }
                    $field = format_multivalue_block($display_value_r, 'datetime');
                    if ($dowrap) {
                        return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                    } else {
                        return $field;
                    }
                } else {
                    return '';
                }
            } else {
                if ($item_attribute_type_r['display_type'] == 'format_mins') {
                    if (is_array($value)) {
                        $values = $value;
                    } else {
                        $values[] = $value;
                    }
                    if (count($values) > 0) {
                        $display_value_r = array();
                        while (list(, $value) = each($values)) {
                            $value = trim($value);
                            if (is_numeric($value)) {
                                // Ensure we have a mask to work with.
                                $display_mask = $item_attribute_type_r['display_type_arg1'];
                                if (strlen($display_mask) == 0) {
                                    $display_mask = '%h %H %m %M';
                                }
                                $hrs = floor($value / 60);
                                // hours
                                $mins = $value % 60;
                                // minutes
                                // Process display_mask and remove any bits that are not needed because the hour/minute is zero.
                                if ($mins == 0 && $hrs > 0) {
                                    // only get rid of minutes if $hrs is a value.
                                    $index = strpos($display_mask, '%H');
                                    if ($index !== FALSE) {
                                        $display_mask = substr($display_mask, 0, $index + 2);
                                    } else {
                                        $index = strpos($display_mask, '%m');
                                        if ($index != FALSE) {
                                            $display_mask = substr($display_mask, 0, $index);
                                        }
                                        //include the %H
                                    }
                                } else {
                                    if ($hrs == 0) {
                                        $index = strpos($display_mask, '%m');
                                        if ($index != FALSE) {
                                            $display_mask = substr($display_mask, $index);
                                        }
                                        //include the %H
                                    }
                                }
                                // Unfortunately we need to do $mins>0 and $hrs>0 if's twice, because otherwise once we
                                // replace the %h and %H the test for $mins>0 would not be able to cut the display_mask,
                                // based on the %h/%H...
                                if ($hrs > 0) {
                                    // Now do all replacements.
                                    $display_mask = str_replace('%h', $hrs, $display_mask);
                                    if ($hrs != 1) {
                                        $display_mask = str_replace('%H', get_opendb_lang_var('hours'), $display_mask);
                                    } else {
                                        $display_mask = str_replace('%H', get_opendb_lang_var('hour'), $display_mask);
                                    }
                                }
                                if ($mins >= 0 || $hrs === 0 && $mins === 0) {
                                    // Now do minute replacements only.
                                    $display_mask = str_replace('%m', $mins, $display_mask);
                                    if ($mins != 1) {
                                        $display_mask = str_replace('%M', get_opendb_lang_var('minutes'), $display_mask);
                                    } else {
                                        $display_mask = str_replace('%M', get_opendb_lang_var('minute'), $display_mask);
                                    }
                                }
                                $display_value_r[] = $display_mask;
                            } else {
                                // what else can we do here?!
                                $display_value_r[] = $value;
                            }
                        }
                        $field = format_multivalue_block($display_value_r, 'format_mins');
                        if ($dowrap) {
                            return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                        } else {
                            return $field;
                        }
                    } else {
                        return '';
                    }
                } else {
                    if ($item_attribute_type_r['display_type'] == 'star_rating') {
                        // arg[0] = rating range
                        if (is_array($value)) {
                            $values = $value;
                        } else {
                            $values[] = $value;
                        }
                        if (count($values) > 0) {
                            $display_value_r = array();
                            while (list(, $value) = each($values)) {
                                $value = trim($value);
                                // no point unless numeric
                                if (is_numeric($value)) {
                                    $total_count = $item_attribute_type_r['display_type_arg1'];
                                    if (is_numeric($total_count)) {
                                        $display_value = '';
                                        $j = $value;
                                        for ($i = 0; $i < $total_count; ++$i) {
                                            if ($j >= 0.75) {
                                                $display_value .= theme_image('rs.gif');
                                            } else {
                                                if ($j >= 0.25) {
                                                    $display_value .= theme_image('rgs.gif');
                                                } else {
                                                    $display_value .= theme_image('gs.gif');
                                                }
                                            }
                                            $j = $j - 1;
                                        }
                                        $ratingmask = $item_attribute_type_r['display_type_arg2'];
                                        if (strlen($ratingmask) > 0) {
                                            $ratingmask = str_replace('%value%', $value, $ratingmask);
                                            $ratingmask = str_replace('%maxrange%', $total_count, $ratingmask);
                                            $display_value = str_replace('%starrating%', $display_value, $ratingmask);
                                        }
                                        if ($item_attribute_type_r['listing_link_ind'] == 'Y') {
                                            $display_value = format_listing_link($value, $display_value, $item_attribute_type_r, NULL);
                                        }
                                    }
                                    $display_value_r[] = $display_value;
                                }
                            }
                            $field = format_multivalue_block($display_value_r, 'starrating');
                            if ($dowrap) {
                                return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                            } else {
                                return $field;
                            }
                        } else {
                            return '';
                            // nothing to do!
                        }
                    } else {
                        if (!is_array($value) && $item_attribute_type_r['display_type'] == 'display' && ifempty($item_attribute_type_r['display_type_arg1'], '%value%') == '%value%') {
                            // Support newline formatting by default.
                            $value = nl2br(trim($value));
                            if ($item_attribute_type_r['listing_link_ind'] == 'Y') {
                                $field = format_listing_links($value, $item_attribute_type_r, 'exact');
                            } else {
                                $field = $value;
                            }
                            if ($dowrap) {
                                return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                            } else {
                                return $field;
                            }
                        } else {
                            if ($item_attribute_type_r['display_type'] == 'list') {
                                //list(list_type [,delimiter])
                                if (is_array($value)) {
                                    $values = $value;
                                    $attr_match = 'exact';
                                } else {
                                    $value = trim($value);
                                    if (strlen($item_attribute_type_r['display_type_arg2']) == 0) {
                                        // Use newline!
                                        $values = explode_lines($value);
                                        $attr_match = 'partial';
                                    } else {
                                        $values = explode($item_attribute_type_r['display_type_arg2'], $value);
                                        if (strlen(trim($item_attribute_type_r['display_type_arg2'])) === 0) {
                                            $attr_match = 'word';
                                        } else {
                                            $attr_match = 'partial';
                                        }
                                    }
                                }
                                $field = format_list_from_array($values, $item_attribute_type_r, $item_attribute_type_r['listing_link_ind'] == 'Y' ? $attr_match : FALSE);
                                if ($dowrap) {
                                    return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                                } else {
                                    return $field;
                                }
                            } else {
                                if ($item_attribute_type_r['display_type'] == 'category' || $item_attribute_type_r['display_type'] == 'display') {
                                    $field = '';
                                    if (is_array($value)) {
                                        $value_array = $value;
                                    } else {
                                        $value_array[] = $value;
                                    }
                                    $attribute_value_rs = array();
                                    if ($item_attribute_type_r['lookup_attribute_ind'] == 'Y') {
                                        $results = fetch_value_match_attribute_type_lookup_rs($item_attribute_type_r['s_attribute_type'], $value_array, get_lookup_order_by($item_attribute_type_r['display_type_arg1']), 'asc');
                                        if ($results) {
                                            while ($lookup_r = db_fetch_assoc($results)) {
                                                $lookup_key = array_search2($lookup_r['value'], $value_array, TRUE);
                                                if ($lookup_key !== FALSE) {
                                                    // Remove the matched element
                                                    array_splice($value_array, $lookup_key, 1);
                                                    $attribute_value_rs[] = array(value => $lookup_r['value'], display => $lookup_r['display'], img => $lookup_r['img']);
                                                }
                                            }
                                            db_free_result($results);
                                        }
                                    }
                                    // where extra items that do not have a matching lookup value.
                                    if (is_not_empty_array($value_array)) {
                                        reset($value_array);
                                        while (list(, $value) = each($value_array)) {
                                            if (strlen(trim($value)) > 0) {
                                                // In case there are extra spaces
                                                $attribute_value_rs[] = array(value => $value, display => $value);
                                            }
                                        }
                                    }
                                    if (is_not_empty_array($attribute_value_rs)) {
                                        $field = format_lookup_display_block($item_attribute_type_r, $attribute_value_rs);
                                        if (strlen($field) > 0) {
                                            if ($dowrap) {
                                                return format_field($item_attribute_type_r['prompt'], $field, $prompt_mask);
                                            } else {
                                                return $field;
                                            }
                                        } else {
                                            return NULL;
                                        }
                                    }
                                } else {
                                    if ($item_attribute_type_r['display_type'] == 'review') {
                                        $total_count = fetch_attribute_type_cnt('S_RATING');
                                        if (is_numeric($total_count)) {
                                            $value = trim($value);
                                            if (!is_numeric($value)) {
                                                $value = 0;
                                            }
                                            $field = '';
                                            $j = $value;
                                            for ($i = 0; $i < $total_count; ++$i) {
                                                if ($j >= 0.75) {
                                                    $field .= theme_image('rs.gif');
                                                } else {
                                                    if ($j >= 0.25) {
                                                        $field .= theme_image('rgs.gif');
                                                    } else {
                                                        $field .= theme_image('gs.gif');
                                                    }
                                                }
                                                $j = $j - 1;
                                            }
                                            // If a mask is defined, format the display value.
                                            if (strlen($item_attribute_type_r['display_type_arg1']) > 0) {
                                                $lookup_r = fetch_attribute_type_lookup_r('S_RATING', $value);
                                                if (is_not_empty_array($lookup_r)) {
                                                    $field .= format_display_value($item_attribute_type_r['display_type_arg1'], $lookup_r['img'], $lookup_r['value'], $lookup_r['display']);
                                                }
                                            }
                                            return $field;
                                            // this is only used in a few places.
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //else -- no display type match.
    if ($dowrap) {
        return format_field($item_attribute_type_r['prompt'], nl2br($value), $prompt_mask);
    } else {
        return nl2br($value);
    }
}
Пример #12
0
function build_announcements_feed($URL, $datemask)
{
    $rssout = '';
    $last_items_list_conf_r = get_opendb_config_var('feeds.announcements');
    // TODO - make the options here configurable
    $result = fetch_announcement_rs(NULL, "DESC", 0, $last_items_list_conf_r['total_num_items'], "N", "Y");
    //$limit_closed
    // Create the RSS item tags
    if ($result && db_num_rows($result) > 0) {
        while ($item_instance_r = db_fetch_assoc($result)) {
            $rssout .= "\n\t<item>" . "\n\t\t<title>" . rss_encoded($item_instance_r['title']) . "</title>" . "\n\t\t<link>" . rss_encoded($URL) . "</link>" . "\n\t\t<pubDate>" . get_localised_timestamp($datemask, $item_instance_r['submit_on']) . " " . date('T') . "</pubDate>" . "\n\t\t<guid>" . rss_encoded($URL) . "</guid>" . "\n\t\t<description>" . rss_encoded(nl2br($item_instance_r['content'])) . "</description>" . "\n\t</item>";
        }
        db_free_result($result);
    }
    return $rssout;
}
Пример #13
0
function get_last_num_items_rs($num_of_items, $owner_id = NULL, $s_item_type = NULL, $update_on = NULL, $not_owner_id = NULL, $site_url_prefix = NULL, $title_mask_id = NULL)
{
    if (strlen($owner_id) > 0) {
        $search_vars_r['owner_id'] = $owner_id;
    }
    if (strlen($s_item_type) > 0) {
        $search_vars_r['s_item_type'] = $s_item_type;
    }
    if (strlen($update_on) > 0) {
        $search_vars_r['update_on'] = $update_on;
    }
    if (strlen($not_owner_id) > 0) {
        $search_vars_r['not_owner_id'] = $not_owner_id;
    }
    $dummy_r = NULL;
    $results = fetch_item_listing_rs($search_vars_r, $dummy_r, 'update_on', 'DESC', 0, $num_of_items);
    if ($results) {
        if ($title_mask_id == 'feeds') {
            $title_mask_group = array('feeds', 'item_display');
        } else {
            $title_mask_group = array('last_items_list', 'item_listing');
        }
        $titleMaskCfg = new TitleMask($title_mask_group);
        $image_attribute_type_rs = NULL;
        while ($item_r = db_fetch_assoc($results)) {
            $item_r['title'] = $titleMaskCfg->expand_item_title($item_r);
            $item_r['update_on'] = get_localised_timestamp(get_opendb_config_var('welcome.last_items_list', 'datetime_mask'), $item_r['update_on']);
            $item_r['item_display_url'] = 'item_display.php?item_id=' . $item_r['item_id'] . '&instance_no=' . $item_r['instance_no'];
            if ($site_url_prefix != NULL) {
                $item_r['item_display_url'] = $site_url_prefix . $item_r['item_display_url'];
            }
            $item_type_r = fetch_item_type_r($item_r['s_item_type']);
            $itemtypeimagesrc = theme_image_src($item_type_r['image']);
            $size = @getimagesize($itemtypeimagesrc);
            if (is_array($size)) {
                $item_r['itemtypeimage']['width'] = $size[0];
                $item_r['itemtypeimage']['height'] = $size[1];
            }
            $item_r['itemtypeimage']['url'] = $itemtypeimagesrc;
            if ($site_url_prefix != NULL) {
                $item_r['itemtypeimage']['url'] = $site_url_prefix . $item_r['itemtypeimage']['url'];
            }
            $item_r['itemtypeimage']['title'] = $item_type_r['description'];
            $item_r['itemtypeimage']['s_item_type'] = $item_r['s_item_type'];
            if (get_opendb_config_var('welcome.last_items_list', 'show_item_image') !== FALSE) {
                if (!is_array($image_attribute_type_rs) || !is_array($image_attribute_type_rs[$item_r['s_item_type']])) {
                    $image_attribute_type_rs[$item_r['s_item_type']] = fetch_sfieldtype_item_attribute_type_r($item_r['s_item_type'], 'IMAGE');
                }
                // of a IMAGE s_attribute defined for this s_item_type
                if (is_array($image_attribute_type_rs[$item_r['s_item_type']])) {
                    $attribute_type_r = $image_attribute_type_rs[$item_r['s_item_type']];
                    $imageurl = fetch_attribute_val($item_r['item_id'], NULL, $attribute_type_r['s_attribute_type']);
                    $file_r = file_cache_get_image_r($imageurl, 'display');
                    $item_r['imageurl']['url'] = $file_r['thumbnail']['url'];
                    if ($site_url_prefix != NULL) {
                        $item_r['imageurl']['url'] = $site_url_prefix . $item_r['imageurl']['url'];
                    }
                    $item_r['imageurl']['width'] = $file_r['thumbnail']['width'];
                    $item_r['imageurl']['height'] = $file_r['thumbnail']['height'];
                    $item_r['imageurl']['title'] = $item_r['title'];
                }
            }
            $item_rs[] = $item_r;
            unset($item_r);
        }
        //while
        db_free_result($results);
    }
    return $item_rs;
}
Пример #14
0
                 echo get_op_confirm_form($PHP_SELF, get_opendb_lang_var('confirm_clear_log'), $HTTP_VARS);
             } else {
                 // confirmation required.
                 $HTTP_VARS['op'] = '';
                 // return to log file without POST params so can do immediate refresh of log
                 opendb_redirect(basename($PHP_SELF) . "?type={$ADMIN_TYPE}");
             }
         }
     } else {
         if ($HTTP_VARS['op'] == 'backup') {
             if (strlen($logging_config_r['backup_ext_date_format']) > 0) {
                 $mask = get_localised_timestamp($logging_config_r['backup_ext_date_format']);
             } else {
                 $mask = get_localised_timestamp('DDMMYY');
             }
             $filename = $logging_config_r['file'] . '.' . get_localised_timestamp($mask);
             $result = @copy($logging_config_r['file'], $filename);
             if ($result) {
                 opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, 'Usage log backed up', array($filename));
                 $success[] = get_opendb_lang_var('backup_successful', 'filename', $filename);
             } else {
                 opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Usage log not backed up', array($filename));
                 $errors[] = get_opendb_lang_var('backup_unsuccessful', 'filename', $filename);
             }
             $HTTP_VARS['op'] = '';
         }
     }
 }
 if ($HTTP_VARS['op'] == '') {
     if (is_array($errors)) {
         echo format_error_block($errors);
Пример #15
0
                 $action_links_rs[] = array(url => 'user_admin.php?op=delete&user_id=' . $user_r['user_id'], img => 'delete_user.gif', text => get_opendb_lang_var('delete_user'));
             } else {
                 if ($user_is_active) {
                     $action_links_rs[] = array(url => 'user_admin.php?op=deactivate&user_id=' . $user_r['user_id'], img => 'deactivate_user.gif', text => get_opendb_lang_var('deactivate_user'));
                 }
             }
             if (!$user_is_active) {
                 $action_links_rs[] = array(url => 'user_admin.php?op=activate&user_id=' . $user_r['user_id'], img => 'activate_user.gif', text => get_opendb_lang_var('activate_user'));
             }
         }
         $action_links_rs[] = array(url => 'user_admin.php?op=change_password&user_id=' . $user_r['user_id'], img => 'change_password.gif', text => get_opendb_lang_var('change_password'));
         $listingObject->addActionColumn($action_links_rs);
         $listingObject->addColumn($user_r['role_description']);
         if ($HTTP_VARS['restrict_active_ind'] != 'X') {
             if ($user_r['active_ind'] == 'Y') {
                 $listingObject->addColumn(strlen($user_r['lastvisit']) > 0 ? get_localised_timestamp(get_opendb_config_var('user_admin', 'datetime_mask'), $user_r['lastvisit']) : get_opendb_lang_var('never_logged_in'));
             } else {
                 $listingObject->addColumn(get_opendb_lang_var('deactivated'));
             }
         }
         $listingObject->endRow();
     }
     db_free_result($result);
 }
 //if($result)
 $listingObject->endListing();
 if ($listingObject->isCheckboxColumns() > 0) {
     if ($HTTP_VARS['restrict_active_ind'] == 'X') {
         $checkbox_action_rs[] = array('action' => 'user_admin.php', 'op' => 'activate_users', link => get_opendb_lang_var('activate_users'));
     } else {
         if (is_valid_opendb_mailer()) {
Пример #16
0
/**
   This will format a status line for the borrowed_item_r passed as parameter.
*/
function get_borrow_details($op, $item_r, $borrowed_item_r)
{
    if ($op == 'check_out' || $op == 'quick_check_out' || $op == 'reminder' || $op == 'admin_send_reminders' || $op == 'extension') {
        if ($borrowed_item_r['due_date'] > 0 && is_numeric($borrowed_item_r['borrow_duration']) && $borrowed_item_r['borrow_duration'] > 0) {
            $details_r[] = get_opendb_lang_var('due_duration_detail', 'borrow_duration', $borrowed_item_r['borrow_duration']);
            $details_r[] = get_opendb_lang_var('due_date_detail', 'date', get_localised_timestamp(get_opendb_config_var('borrow', 'date_mask'), $borrowed_item_r['due_date']));
        }
    }
    if ($op == 'check_in' || $op == 'reminder' || $op == 'admin_send_reminders') {
        if ($borrowed_item_r['total_duration'] > 0 && is_numeric($borrowed_item_r['borrow_duration']) && $borrowed_item_r['borrow_duration'] > 0) {
            $details_r[] = get_opendb_lang_var('total_duration_detail', 'total_duration', $borrowed_item_r['total_duration']);
            if ($borrowed_item_r['total_duration'] > $borrowed_item_r['borrow_duration']) {
                $overdue_duration = $borrowed_item_r['total_duration'] - $borrowed_item_r['borrow_duration'];
                $details_r[] = get_opendb_lang_var('overdue_duration_detail', 'overdue_duration', $overdue_duration);
            }
        }
    }
    return $details_r;
}