Exemple #1
0
function configure_backend($option)
{
    global $my, $booklibrary_configuration, $acl;
    global $mosConfig_absolute_path;
    $yesno[] = mosHTML::makeOption('1', _BOOKLIBRARY_YES);
    $yesno[] = mosHTML::makeOption('0', _BOOKLIBRARY_NO);
    $gtree[] = mosHTML::makeOption('-2', 'Everyone');
    $gtree = get_group_children_tree_bl();
    $lists = array();
    $f = array();
    $s = explode(',', $booklibrary_configuration['review_added_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['review_added_email']['registrationlevel'] = mosHTML::selectList($gtree, 'review_added_email_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $lists['review_added_email']['show'] = mosHTML::RadioList($yesno, 'review_added_email_show', 'class="inputbox"', $booklibrary_configuration['review_added_email']['show'], 'value', 'text');
    $f = array();
    $s = explode(',', $booklibrary_configuration['suggest_added_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['suggest_added_email']['show'] = mosHTML::RadioList($yesno, 'suggest_added_email_show', 'class="inputbox"', $booklibrary_configuration['suggest_added_email']['show'], 'value', 'text', $booklibrary_configuration['suggest_added_email']['show']);
    $lists['suggest_added_email']['registrationlevel'] = mosHTML::selectList($gtree, 'suggest_added_email_registrationlevel[] ', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $f = array();
    $s = explode(',', $booklibrary_configuration['lendrequest_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['lendrequest_email']['show'] = mosHTML::RadioList($yesno, 'lendrequest_email_show', 'class="inputbox"', $booklibrary_configuration['lendrequest_email']['show'], 'value', 'text');
    $lists['lendrequest_email']['registrationlevel'] = mosHTML::selectList($gtree, 'lendrequest_email_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $f = array();
    $s = explode(',', $booklibrary_configuration['addbook_email']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['addbook_email']['show'] = mosHTML::RadioList($yesno, 'addbook_email_show', 'class="inputbox"', $booklibrary_configuration['addbook_email']['show'], 'value', 'text');
    $lists['addbook_email']['registrationlevel'] = mosHTML::selectList($gtree, 'addbook_email_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    $lists['review_email']['address'] = '<input type="text" name="review_email_address" value="' . $booklibrary_configuration['review_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    //back--1
    $lists['suggest_email']['address'] = '<input type="text" name="suggest_email_address" value="' . $booklibrary_configuration['suggest_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['lendrequest_email']['address'] = '<input type="text" name="lendrequest_email_address" value="' . $booklibrary_configuration['lendrequest_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['addbook_email']['address'] = '<input type="text" name="addbook_email_address" value="' . $booklibrary_configuration['addbook_email']['address'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['bookid']['auto-increment']['boolean'] = mosHTML::RadioList($yesno, 'bookid_auto_increment_boolean', 'class="inputbox"', $booklibrary_configuration['bookid']['auto-increment']['boolean'], 'value', 'text');
    //********   begin add merge description   ************************/
    $f = array();
    $s = explode(',', $booklibrary_configuration['merge_description']['registrationlevel']);
    for ($i = 0; $i < count($s); $i++) {
        $f[] = mosHTML::makeOption($s[$i]);
    }
    $lists['merge_description']['use'] = mosHTML::RadioList($yesno, 'merge_description_use', 'class="inputbox"', $booklibrary_configuration['merge_description']['use'], 'value', 'text');
    $lists['merge_description']['registrationlevel'] = mosHTML::selectList($gtree, 'merge_description_registrationlevel[]', 'size="4" multiple="multiple"', 'value', 'text', $f);
    //********   end add merge description  **********************/
    $lists['fetchImages']['boolean'] = mosHTML::RadioList($yesno, 'fetchImages_boolean', 'class="inputbox"', $booklibrary_configuration['fetchImages']['boolean'], 'value', 'text');
    $lists['fetchImages']['location'] = '<input disabled="disabled" type="text" name="fetchImages_location" value="' . $booklibrary_configuration['fetchImages']['location'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ebooks']['allow'] = mosHTML::RadioList($yesno, 'ebooks_allow', 'class="inputbox"', $booklibrary_configuration['ebooks']['allow'], 'value', 'text');
    $lists['ebooks']['location'] = '<input disabled="disabled" type="text" name="ebooks_location" value="' . $booklibrary_configuration['ebooks']['location'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ws']['amazon']['tag'] = '<input type="text" name="ws_amazon_tag" value="' . $booklibrary_configuration['ws']['amazon']['tag'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ws']['amazon']['devtag'] = '<input type="text" name="ws_amazon_devtag" value="' . $booklibrary_configuration['ws']['amazon']['devtag'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    $lists['ws']['amazon']['secret_key'] = '<input type="text" name="ws_amazon_secret_key" value="' . $booklibrary_configuration['ws']['amazon']['secret_key'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    @($lists['editbook']['check']['isbn'] = mosHTML::RadioList($yesno, 'editbook_check_isbn', 'class="inputbox"', $booklibrary_configuration['editbook']['check']['isbn'], 'value', 'text'));
    //back--7
    /////////////////////////////////ANTON CODE////////////////////////////////////
    /////////////Proxy Relase
    $lists['proxy_server']['address'] = '<input type="text" name="proxy_server_adress" value="' . $booklibrary_configuration['proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    $lists['port_proxy_server']['address'] = '<input type="text" name="port_proxy_server_adress" value="' . $booklibrary_configuration['port_proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    $lists['login_proxy_server']['address'] = '<input type="text" name="login_proxy_server_adress" value="' . $booklibrary_configuration['login_proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    $lists['password_proxy_server']['address'] = '<input type="text" name="password_proxy_server_adress" value="' . $booklibrary_configuration['password_proxy_server']['address'] . '"class="inputbox" size="50" maxlength="50" title="" />';
    /////////////////////////////////ANTON CODE////////////////////////////////////
    $lists['yaz']['connection_string'] = '<input class="inputbox" type="file" name="yaz_connection_file" value="" size="50" maxlength="250" />';
    $lists['update'] = mosHTML::RadioList($yesno, 'update', 'class="inputbox"', $booklibrary_configuration['update'], 'value', 'text');
    //get language List
    $retVal1 = mosBooklibraryOthers::getLanguageArray();
    $lang = null;
    for ($i = 0, $n = count($retVal1); $i < $n; $i++) {
        $help = $retVal1[$i];
        $lang[] = mosHTML::makeOption($help[0], $help[1]);
    }
    $lists['editbook']['default']['lang'] = mosHTML::selectList($lang, 'editbook_default_lang', 'class="inputbox" size="1"', 'value', 'text', $booklibrary_configuration['editbook']['default']['lang']);
    //get host List
    $retVal = mosBooklibraryWS::getArray();
    $ws = null;
    for ($i = 0, $n = count($retVal); $i < $n; $i++) {
        $help = $retVal[$i];
        $ws[] = mosHTML::makeOption($help[0], $help[1]);
    }
    $lists['editbook']['default']['host'] = mosHTML::selectList($ws, 'editbook_default_host', 'class="inputbox" size="1"', 'value', 'text', intval($booklibrary_configuration['editbook']['default']['host']));
    $lists['lend_answer'] = mosHTML::RadioList($yesno, 'lend_answer', 'class="inputbox"', $booklibrary_configuration['lend_answer'], 'value', 'text');
    $lists['lend_form'] = $booklibrary_configuration['lend_form'];
    $lists['ebooks']['registrationlevel'] = mosHTML::selectList($gtree, 'ebooks_registrationlevel', 'size="4"', 'value', 'text', $my->id);
    //(rus)--i tam i tam nado navernoe!
    $lists['lend_before_end_notify'] = mosHTML::RadioList($yesno, 'lend_before_end_notify', 'class="inputbox"', $booklibrary_configuration['lend_before_end_notify'], 'value', 'text');
    $lists['lend_before_end_notify_days'] = '<input type="text" name="lend_before_end_notify_days" value="' . $booklibrary_configuration['lend_before_end_notify_days'] . '" class="inputbox" size="2" maxlength="2" title="" />';
    $lists['lend_before_end_notify_email'] = '<input type="text" name="lend_before_end_notify_email" value="' . $booklibrary_configuration['lend_before_end_notify_email'] . '" class="inputbox" size="50" maxlength="50" title="" />';
    HTML_booklibrary::showConfiguration_backend($lists, $option);
}
 /**
  * Get the parameter of the WS by the id
  * @param int $id the id of the WS-pram that should be returned
  * @return string the parameter of the WS or null if it can't be found
  */
 static function getWsParamById($id)
 {
     $services = mosBooklibraryWS::getArray();
     for ($i = 0, $n = count($services); $i < $n; $i++) {
         if (intval($services[$i][0]) == intval($id)) {
             return $services[$i][2];
         }
     }
     return null;
 }
Exemple #3
0
 static function add_book_fe($option, $bid)
 {
     global $database, $my, $mosConfig_live_site, $booklibrary_configuration, $Itemid, $mainframe;
     PHP_booklibrary::addTitleAndMetaTags();
     $book = new mosBookLibrary($database);
     $book->load(intval($bid));
     if ($bid != 0 && $my->email != $book->owneremail) {
         mosRedirect('index.php?option=com_booklibrary&Itemid=$Itemid');
         exit;
     }
     if ($bid == 0) {
         $pathway = sefRelToAbs('index.php?option=' . $option . '&amp;task=add_book_fe&amp;Itemid=' . $Itemid);
         $pathway_name = _BOOKLIBRARY_LABEL_TITLE_ADD_BOOK;
     } else {
         $pathway = sefRelToAbs('index.php?option=' . $option . '&amp;task=edit_book&amp;Itemid=' . $Itemid . '&amp;id=' . $bid);
         $pathway_name = _BOOKLIBRARY_LABEL_TITLE_EDIT_BOOK;
     }
     $path_way = $mainframe->getPathway();
     $path_way->addItem($pathway_name, $pathway);
     $tpl_list = array();
     if (array_key_exists('catid', $_POST)) {
         $catid = intval($_POST['catid']);
     } else {
         $catid = '';
     }
     $auto_bookID = '';
     if ($booklibrary_configuration['bookid']['auto-increment']['boolean'] == 1) {
         $database->setQuery("select bookid from #__booklibrary ORDER by bookid");
         $bookids = $database->loadObjectList();
         foreach ($bookids as $bookid) {
             if (!is_numeric($bookid->bookid)) {
                 echo "<script> alert('You have no numeric BookId. Please set option  " . _BOOKLIBRARY_ADMIN_CONFIG_BOOKID_AUTO_INCREMENT . " to \\'No\\' or change all BookID to numeric '); window.history.go(-1); </script>\n";
                 exit;
             }
             if ((int) $auto_bookID < $bookid->bookid) {
                 $auto_bookID = $bookid->bookid;
             }
         }
         if ($auto_bookID != '') {
             ++$auto_bookID;
         } else {
             $auto_bookID = 1;
         }
     }
     $categories[] = mosHTML::makeOption('0', _BOOKLIBRARY_LABEL_SELECT_CATEGORIES);
     $query = "SELECT  id ,name, parent_id as parent" . "\n FROM #__booklibrary_main_categories" . "\n WHERE section='com_booklibrary'" . "\n AND published > 0" . "\n ORDER BY parent_id, ordering";
     $database->setQuery($query);
     $rows = $database->loadObjectList();
     // establish the hierarchy of the categories
     $children = array();
     // first pass - collect children
     foreach ($rows as $v) {
         $pt = $v->parent;
         $list = @$children[$pt] ? $children[$pt] : array();
         array_push($list, $v);
         $children[$pt] = $list;
     }
     // second pass - get an indent list of the items
     $list = PHP_booklibrary::bookLibraryTreeRecurse(0, '', array(), $children);
     foreach ($list as $i => $item) {
         $item->text = $item->treename;
         $item->value = $item->id;
         $list[$i] = $item;
     }
     $categories = array_merge($categories, $list);
     $allow_categories = explode(',', $booklibrary_configuration['addbook_button']['allow']['categories']);
     if (count($categories) <= 1) {
         mosRedirect("index.php?option=com_booklibrary&section=categories", _BOOKLIBRARY_ADMIN_IMPEXP_ADD);
     }
     $query = "select catid from #__booklibrary_categories where bookid='" . $book->id . "'";
     $database->setQuery($query);
     if (version_compare(JVERSION, '3.0', 'lt')) {
         $cat_idlist = $database->loadResultArray();
     } else {
         $cat_idlist = $database->loadColumn();
     }
     if (empty($cat_idlist)) {
         $cat_idlist[0] = '0';
     }
     if (in_array("-2", $allow_categories)) {
         $clist = mosHTML::selectList($categories, 'catid[]', 'class="inputbox" multiple', 'value', 'text', $cat_idlist);
     } else {
         $categories_n = array();
         for ($i = 1; $i < count($categories); $i++) {
             if (in_array($categories[$i]->id, $allow_categories)) {
                 $categories_n[] = $categories[$i];
             }
         }
         $clist = mosHTML::selectList($categories_n, 'catid[]', 'class="inputbox" multiple', 'value', 'text', $cat_idlist);
     }
     $tpl_list['clist'] = $clist;
     $tpl_list['ncid'] = $catid;
     // get list of WS
     $retVal = mosBooklibraryWS::getArray();
     $ws = null;
     for ($i = 0, $n = count($retVal); $i < $n; $i++) {
         $help = $retVal[$i];
         $ws[] = mosHTML::makeOption($help[0], $help[1]);
     }
     $tpl_list['wlist'] = mosHTML::selectList($ws, 'informationFrom', 'class="inputbox" size="1"', 'value', 'text', intval($booklibrary_configuration['editbook']['default']['host']));
     //get language List
     $retVal1 = mosBooklibraryOthers::getLanguageArray();
     $lang = null;
     for ($i = 0, $n = count($retVal1); $i < $n; $i++) {
         $help = $retVal1[$i];
         $lang[] = mosHTML::makeOption($help[0], $help[1]);
     }
     $tpl_list['langlist'] = mosHTML::selectList($lang, 'language', 'class="inputbox" size="1"', 'value', 'text', $booklibrary_configuration['editbook']['default']['lang']);
     $tpl_list['auto_bookID'] = $auto_bookID;
     //get Rating
     $retVal2 = mosBooklibraryOthers::getRatingArray();
     $rating = null;
     for ($i = 0, $n = count($retVal2); $i < $n; $i++) {
         $help = $retVal2[$i];
         $rating[] = mosHTML::makeOption($help[0], $help[1]);
     }
     $ratinglist = mosHTML::selectList($rating, 'rating', 'class="inputbox" size="1"', 'value', 'text', $book->rating);
     HTML_booklibrary::showAddBook($tpl_list, $option, $Itemid, $ratinglist, $book);
 }