예제 #1
0
 private function processData($pages)
 {
     if (!empty($pages)) {
         $prefLocale = osc_current_user_locale();
         foreach ($pages as $aRow) {
             $row = array();
             $content = array();
             if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
                 $content = $aRow['locale'][$prefLocale];
             } else {
                 $content = current($aRow['locale']);
             }
             // -- options --
             $options = array();
             View::newInstance()->_exportVariableToView('page', $aRow);
             $options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
             $options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&amp;action=edit&amp;id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
             if (!$aRow['b_indelible']) {
                 $options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&amp;action=delete&amp;id=' . $aRow['pk_i_id'] . '&amp;' . osc_csrf_token_url() . '">' . __('Delete') . '</a>';
             }
             $auxOptions = '<ul>' . PHP_EOL;
             foreach ($options as $actual) {
                 $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
             }
             $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
             $row['bulkactions'] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
             $row['internal_name'] = $aRow['s_internal_name'] . $actions;
             $row['title'] = $content['s_title'];
             $row['order'] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" />  <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
             $row = osc_apply_filter('pages_processing_row', $row, $aRow);
             $this->addRow($row);
             $this->rawRows[] = $aRow;
         }
     }
 }
예제 #2
0
파일: header.php 프로젝트: naneri/Osclass
function add_market_jsvariables()
{
    $marketPage = Params::getParam("mPage");
    $version_length = strlen(osc_version());
    $main_version = substr(osc_version(), 0, $version_length - 2) . "." . substr(osc_version(), $version_length - 2, 1);
    if ($marketPage >= 1) {
        $marketPage--;
    }
    $action = Params::getParam("action");
    $js_lang = array('by' => __('by'), 'ok' => __('Ok'), 'error_item' => __('There was a problem, try again later please'), 'wait_download' => __('Please wait until the download is completed'), 'downloading' => __('Downloading'), 'close' => __('Close'), 'download' => __('Download'), 'update' => __('Update'), 'last_update' => __('Last update'), 'downloads' => __('Downloads'), 'requieres_version' => __('Requires at least'), 'compatible_with' => __('Compatible up to'), 'screenshots' => __('Screenshots'), 'preview_theme' => __('Preview theme'), 'download_manually' => __('Download manually'), 'buy' => __('Buy'), 'proceed_anyway' => sprintf(__('Warning! This package is not compatible with your current version of Osclass (%s)'), $main_version), 'sure' => __('Are you sure?'), 'proceed_anyway_btn' => __('Ok, proceed anyway'), 'not_compatible' => sprintf(__('Warning! This theme is not compatible with your current version of Osclass (%s)'), $main_version), 'themes' => array('download_ok' => __('The theme has been downloaded correctly, proceed to activate or preview it.')), 'plugins' => array('download_ok' => __('The plugin has been downloaded correctly, proceed to install and configure.')), 'languages' => array('download_ok' => __('The language has been downloaded correctly, proceed to activate.')));
    ?>
        <script type="text/javascript">
            var theme = window.theme || {};
            theme.adminBaseUrl  = "<?php 
    echo osc_admin_base_url(true);
    ?>
";
            theme.marketAjaxUrl = "<?php 
    echo osc_admin_base_url(true);
    ?>
?page=ajax&action=market&<?php 
    echo osc_csrf_token_url();
    ?>
";
            theme.marketCurrentURL = "<?php 
    echo osc_admin_base_url(true);
    ?>
?page=market&action=<?php 
    echo Params::getParam('action');
    ?>
";
            theme.themUrl       = "<?php 
    echo osc_current_admin_theme_url();
    ?>
";
            theme.langs         = <?php 
    echo json_encode($js_lang);
    ?>
;
            theme.CSRFToken     = "<?php 
    echo osc_csrf_token_url();
    ?>
";

            var osc_market = {};
            osc_market.main_version = <?php 
    echo $main_version;
    ?>
;

        </script>
        <?php 
}
예제 #3
0
파일: ajax.php 프로젝트: nsswaga/OSClass
 function doModel()
 {
     //specific things for this class
     switch ($this->action) {
         case 'bulk_actions':
             break;
         case 'regions':
             //Return regions given a countryId
             $regions = Region::newInstance()->getByCountry(Params::getParam("countryId"));
             echo json_encode($regions);
             break;
         case 'cities':
             //Returns cities given a regionId
             $cities = City::newInstance()->getByRegion(Params::getParam("regionId"));
             echo json_encode($cities);
             break;
         case 'location':
             // This is the autocomplete AJAX
             $cities = City::newInstance()->ajax(Params::getParam("term"));
             echo json_encode($cities);
             break;
         case 'alerts':
             // Allow to register to an alert given (not sure it's used on admin)
             $alert = Params::getParam("alert");
             $email = Params::getParam("email");
             $userid = Params::getParam("userid");
             if ($alert != '' && $email != '') {
                 Alerts::newInstance()->insert(array('fk_i_user_id' => $userid, 's_email' => $email, 's_search' => $alert, 'e_type' => 'DAILY'));
                 echo "1";
                 return true;
             }
             echo '0';
             break;
         case 'runhook':
             //Run hooks
             $hook = Params::getParam("hook");
             switch ($hook) {
                 case 'item_form':
                     $catId = Params::getParam("catId");
                     if ($catId != '') {
                         osc_run_hook("item_form", $catId);
                     } else {
                         osc_run_hook("item_form");
                     }
                     break;
                 case 'item_edit':
                     $catId = Params::getParam("catId");
                     $itemId = Params::getParam("itemId");
                     osc_run_hook("item_edit", $catId, $itemId);
                     break;
                 default:
                     if ($hook == '') {
                         return false;
                     } else {
                         osc_run_hook($hook);
                     }
                     break;
             }
             break;
         case 'items':
             // Return items (use external file oc-admin/ajax/item_processing.php)
             require_once osc_admin_base_path() . 'ajax/items_processing.php';
             $items_processing = new items_processing_ajax(Params::getParamsAsArray("get"));
             break;
         case 'media':
             // Return items (use external file oc-admin/ajax/media_processing.php)
             require_once osc_admin_base_path() . 'ajax/media_processing.php';
             $media_processing = new media_processing_ajax(Params::getParamsAsArray("get"));
             break;
         case 'categories_order':
             // Save the order of the categories
             $aIds = Params::getParam('list');
             $orderParent = 0;
             $orderSub = 0;
             $catParent = 0;
             $catManager = Category::newInstance();
             foreach ($aIds as $id => $parent) {
                 if ($parent == 'root') {
                     if (!$catManager->update_order($id, $orderParent)) {
                         $error = 1;
                     }
                     // set parent category
                     $conditions = array('pk_i_id' => $id);
                     $array['fk_i_parent_id'] = DB_CONST_NULL;
                     if (!$catManager->update($array, $conditions) > 0) {
                         $error = 1;
                     }
                     $orderParent++;
                 } else {
                     if ($parent != $catParent) {
                         $catParent = $parent;
                         $orderSub = 0;
                     }
                     if (!$catManager->update_order($id, $orderSub)) {
                         $error = 1;
                     }
                     // set parent category
                     $conditions = array('pk_i_id' => $id);
                     $array['fk_i_parent_id'] = $catParent;
                     if (!$catManager->update($array, $conditions) > 0) {
                         $error = 1;
                     }
                     $orderSub++;
                 }
             }
             $result = "{";
             $error = 0;
             if ($error) {
                 $result .= '"error" : "' . __("Some error ocurred") . '"';
             } else {
                 $result .= '"ok" : "' . __("Order saved") . '"';
             }
             $result .= "}";
             echo $result;
             break;
         case 'category_edit_iframe':
             $this->_exportVariableToView("category", Category::newInstance()->findByPrimaryKey(Params::getParam("id")));
             $this->_exportVariableToView("languages", OSCLocale::newInstance()->listAllEnabled());
             $this->doView("categories/iframe.php");
             break;
         case 'field_categories_iframe':
             $selected = Field::newInstance()->categories(Params::getParam("id"));
             if ($selected == null) {
                 $selected = array();
             }
             $this->_exportVariableToView("selected", $selected);
             $this->_exportVariableToView("field", Field::newInstance()->findByPrimaryKey(Params::getParam("id")));
             $this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
             $this->doView("fields/iframe.php");
             break;
         case 'field_categories_post':
             $error = 0;
             if (!$error) {
                 try {
                     $field = Field::newInstance()->findByName(Params::getParam("s_name"));
                     if (!isset($field['pk_i_id']) || isset($field['pk_i_id']) && $field['pk_i_id'] == Params::getParam("id")) {
                         Field::newInstance()->cleanCategoriesFromField(Params::getParam("id"));
                         $slug = Params::getParam("field_slug") != '' ? Params::getParam("field_slug") : Params::getParam("id");
                         $slug = preg_replace('|([-]+)|', '-', preg_replace('|[^a-z0-9_-]|', '-', strtolower($slug)));
                         Field::newInstance()->update(array('s_name' => Params::getParam("s_name"), 'e_type' => Params::getParam("field_type"), 's_slug' => $slug, 'b_required' => Params::getParam("field_required") == "1" ? 1 : 0, 's_options' => Params::getParam('s_options')), array('pk_i_id' => Params::getParam("id")));
                         Field::newInstance()->insertCategories(Params::getParam("id"), Params::getParam("categories"));
                     } else {
                         $error = 1;
                         $message = __("Sorry, you already have one field with that name");
                     }
                 } catch (Exception $e) {
                     $error = 1;
                     $message = __("Error while updating.");
                 }
             }
             $result = "{";
             if ($error) {
                 $result .= '"error" : "';
                 $result .= $message;
                 $result .= '"';
             } else {
                 $result .= '"ok" : "' . __("Saved") . '", "text" : "' . Params::getParam("s_name") . '"';
             }
             $result .= "}";
             echo $result;
             break;
         case 'delete_field':
             $id = Params::getParam("id");
             $error = 0;
             try {
                 $fieldManager = Field::newInstance();
                 $fieldManager->deleteByPrimaryKey($id);
                 $message = __('The custom field have been deleted');
             } catch (Exception $e) {
                 $error = 1;
                 $message = __('Error while deleting');
             }
             $result = "{";
             if ($error) {
                 $result .= '"error" : "';
                 $result .= $message;
                 $result .= '"';
             } else {
                 $result .= '"ok" : "Saved." ';
             }
             $result .= "}";
             echo $result;
             break;
         case 'enable_category':
             $id = Params::getParam("id");
             $enabled = Params::getParam("enabled") != '' ? Params::getParam("enabled") : 0;
             $error = 0;
             $aUpdated = "";
             try {
                 if ($id != '') {
                     $categoryManager = Category::newInstance();
                     $categoryManager->update(array('b_enabled' => $enabled), array('pk_i_id' => $id));
                     if ($enabled == 1) {
                         $msg = __('The category has been enabled');
                     } else {
                         $msg = __('The category has been disabled');
                     }
                     $categoryManager->update(array('b_enabled' => $enabled), array('fk_i_parent_id' => $id));
                     $aUpdated = $categoryManager->listWhere("fk_i_parent_id = {$id}");
                     if ($enabled == 1) {
                         $msg .= "<br>" . __('The subcategories has been enabled');
                     } else {
                         $msg .= "<br>" . __('The subcategories has been disabled');
                     }
                 } else {
                     $error = 1;
                     $msg = __('There was a problem with this page. The ID for the category hasn\'t been set');
                 }
                 $message = $msg;
             } catch (Exception $e) {
                 $error = 1;
                 $message = __('Error: %s') . " " . $e->getMessage();
             }
             $result = "{";
             $error = 0;
             if ($error) {
                 $result .= '"error" : "' . $message . '"';
             } else {
                 $result .= '"ok" : "' . $message . '"';
                 if (count($aUpdated) > 0) {
                     $result .= ', "afectedIds": [';
                     foreach ($aUpdated as $category) {
                         $result .= '{ "id" : "' . $category['pk_i_id'] . '" },';
                     }
                     $result = substr($result, 0, -1);
                     $result .= ']';
                 } else {
                     $result .= ', "afectedIds": []';
                 }
             }
             $result .= "}";
             echo $result;
             break;
         case 'delete_category':
             $id = Params::getParam("id");
             $error = 0;
             try {
                 $categoryManager = Category::newInstance();
                 $categoryManager->deleteByPrimaryKey($id);
                 $message = __('The categories have been deleted');
             } catch (Exception $e) {
                 $error = 1;
                 $message = __('Error while deleting');
             }
             $result = "{";
             if ($error) {
                 $result .= '"error" : "';
                 $result .= $message;
                 $result .= '"';
             } else {
                 $result .= '"ok" : "Saved." ';
             }
             $result .= "}";
             echo $result;
             break;
         case 'edit_category_post':
             $id = Params::getParam("id");
             $fields['i_expiration_days'] = Params::getParam("i_expiration_days") != '' ? Params::getParam("i_expiration_days") : 0;
             $error = 0;
             $postParams = Params::getParamsAsArray();
             foreach ($postParams as $k => $v) {
                 if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                     if ($m[2] == 's_name') {
                         if ($v != "") {
                             $aFieldsDescription[$m[1]][$m[2]] = $v;
                         } else {
                             $error = 1;
                             $message = __("All titles are required");
                         }
                     } else {
                         $aFieldsDescription[$m[1]][$m[2]] = $v;
                     }
                 }
             }
             $l = osc_language();
             if (!$error) {
                 try {
                     $categoryManager = Category::newInstance();
                     $categoryManager->updateByPrimaryKey($fields, $aFieldsDescription, $id);
                 } catch (Exception $e) {
                     $error = 1;
                     $message = __("Error while updating.");
                 }
             }
             $result = "{";
             if ($error) {
                 $result .= '"error" : "';
                 $result .= $message;
                 $result .= '"';
             } else {
                 $result .= '"ok" : "' . __("Saved") . '", "text" : "' . $aFieldsDescription[$l]['s_name'] . '"';
             }
             $result .= "}";
             echo $result;
             break;
         case 'custom':
             // Execute via AJAX custom file
             $ajaxfile = Params::getParam("ajaxfile");
             if ($ajaxfile != '') {
                 require_once osc_admin_base_path() . $ajaxfile;
             } else {
                 echo json_encode(array('error' => __('no action defined')));
             }
             break;
         case 'test_mail':
             $title = __('Test email') . ", " . osc_page_title();
             $body = __("Test email") . "<br><br>" . osc_page_title();
             $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
             $array = array();
             if (osc_sendMail($emailParams)) {
                 $array = array('status' => '1', 'html' => __('Email sent successfully'));
             } else {
                 $array = array('status' => '0', 'html' => __('An error has occurred while sending email'));
             }
             echo json_encode($array);
             break;
         case 'order_pages':
             $order = Params::getParam("order");
             $id = Params::getParam("id");
             $count = osc_count_static_pages();
             if ($order != '' && $id != '') {
                 $mPages = Page::newInstance();
                 $actual_page = $mPages->findByPrimaryKey($id);
                 $actual_order = $actual_page['i_order'];
                 $array = array();
                 $condition = array();
                 $new_order = $actual_order;
                 if ($order == 'up') {
                     if ($actual_order > 0) {
                         $new_order = $actual_order - 1;
                     }
                 } else {
                     if ($order == 'down') {
                         if ($actual_order != $count - 1) {
                             $new_order = $actual_order + 1;
                         }
                     }
                 }
                 if ($new_order != $actual_order) {
                     $auxpage = $mPages->findByOrder($new_order);
                     $array = array('i_order' => $actual_order);
                     $conditions = array('pk_i_id' => $auxpage['pk_i_id']);
                     $mPages->update($array, $conditions);
                     $array = array('i_order' => $new_order);
                     $conditions = array('pk_i_id' => $id);
                     $mPages->update($array, $conditions);
                 } else {
                 }
                 // json for datatables
                 $prefLocale = osc_current_admin_locale();
                 $aPages = $mPages->listAll(0);
                 $json = "[";
                 foreach ($aPages as $key => $page) {
                     $body = array();
                     if (isset($page['locale'][$prefLocale]) && !empty($page['locale'][$prefLocale]['s_title'])) {
                         $body = $page['locale'][$prefLocale];
                     } else {
                         $body = current($page['locale']);
                     }
                     $p_body = str_replace("'", "\\'", trim(strip_tags($body['s_title']), "\"'"));
                     $json .= "[\"<input type='checkbox' name='id[]' value='" . $page['pk_i_id'] . "' />\",";
                     $json .= "\"" . $page['s_internal_name'] . "<div id='datatables_quick_edit'>";
                     $json .= "<a href='" . osc_static_page_url() . "'>" . __('View page') . "</a> | ";
                     $json .= "<a href='" . osc_admin_base_url(true) . "?page=pages&action=edit&id=" . $page['pk_i_id'] . "'>";
                     $json .= __('Edit') . "</a>";
                     if (!$page['b_indelible']) {
                         $json .= " | ";
                         $json .= "<a onclick=\\\"javascript:return confirm('";
                         $json .= __('This action can\\\\\'t be undone. Are you sure you want to continue?') . "')\\\" ";
                         $json .= " href='" . osc_admin_base_url(true) . "?page=pages&action=delete&id=" . $page['pk_i_id'] . "'>";
                         $json .= __('Delete') . "</a>";
                     }
                     $json .= "</div>\",";
                     $json .= "\"" . $p_body . "\",";
                     $json .= "\"<img id='up' onclick='order_up(" . $page['pk_i_id'] . ");' style='cursor:pointer;width:15;height:15px;' src='" . osc_current_admin_theme_url('images/arrow_up.png') . "'/> <br/> <img id='down' onclick='order_down(" . $page['pk_i_id'] . ");' style='cursor:pointer;width:15;height:15px;' src='" . osc_current_admin_theme_url('images/arrow_down.png') . "'/>\"]";
                     if ($key != count($aPages) - 1) {
                         $json .= ',';
                     } else {
                         $json .= '';
                     }
                 }
                 $json .= "]";
                 echo $json;
             }
             break;
             /******************************
              ** COMPLETE UPGRADE PROCESS **
              ******************************/
         /******************************
          ** COMPLETE UPGRADE PROCESS **
          ******************************/
         case 'upgrade':
             // AT THIS POINT WE KNOW IF THERE'S AN UPDATE OR NOT
             $message = "";
             $error = 0;
             $remove_error_msg = "";
             $sql_error_msg = "";
             $rm_errors = 0;
             $perms = osc_save_permissions();
             osc_change_permissions();
             $maintenance_file = ABS_PATH . '.maintenance';
             $fileHandler = @fopen($maintenance_file, 'w');
             fclose($fileHandler);
             /***********************
              **** DOWNLOAD FILE ****
              ***********************/
             if (Params::getParam('file') != '') {
                 $tmp = explode("/", Params::getParam('file'));
                 $filename = end($tmp);
                 $result = osc_downloadFile(Params::getParam('file'), $filename);
                 if ($result) {
                     // Everything is OK, continue
                     /**********************
                      ***** UNZIP FILE *****
                      **********************/
                     @mkdir(ABS_PATH . 'oc-temp', 0777);
                     $res = osc_unzip_file(osc_content_path() . 'downloads/' . $filename, ABS_PATH . 'oc-temp/');
                     if ($res == 1) {
                         // Everything is OK, continue
                         /**********************
                          ***** COPY FILES *****
                          **********************/
                         $fail = -1;
                         if ($handle = opendir(ABS_PATH . 'oc-temp')) {
                             $fail = 0;
                             while (false !== ($_file = readdir($handle))) {
                                 if ($_file != '.' && $_file != '..' && $_file != 'remove.list' && $_file != 'upgrade.sql' && $_file != 'customs.actions') {
                                     $data = osc_copy(ABS_PATH . "oc-temp/" . $_file, ABS_PATH . $_file);
                                     if ($data == false) {
                                         $fail = 1;
                                     }
                                 }
                             }
                             closedir($handle);
                             if ($fail == 0) {
                                 // Everything is OK, continue
                                 /**********************
                                  **** REMOVE FILES ****
                                  **********************/
                                 if (file_exists(ABS_PATH . 'oc-temp/remove.list')) {
                                     $lines = file(ABS_PATH . 'oc-temp/remove.list', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                                     foreach ($lines as $line_num => $r_file) {
                                         $unlink = @unlink(ABS_PATH . $r_file);
                                         if (!$unlink) {
                                             $remove_error_msg .= sprintf(__('Error removing file: %s'), $r_file) . "<br/>";
                                         }
                                     }
                                 }
                                 // Removing files is not important for the rest of the proccess
                                 // We will inform the user of the problems but the upgrade could continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = getConnection();
                                     $error_queries = $conn->osc_updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         define('AUTO_UPGRADE', true);
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
                                             if (!unlink($dir->getPathname())) {
                                                 $rm_errors++;
                                             }
                                         }
                                     }
                                     if (!rmdir($path)) {
                                         $rm_errors++;
                                     }
                                     $deleted = @unlink(ABS_PATH . '.maintenance');
                                     if ($rm_errors == 0) {
                                         $message = __('Everything was OK! Your OSClass installation is updated');
                                     } else {
                                         $message = __('Almost everything was OK! Your OSClass installation is updated, but there were some errors removing temporary files. Please, remove manually the "oc-temp" folder');
                                         $error = 6;
                                         // Some errors removing files
                                     }
                                 } else {
                                     $sql_error_msg = $error_queries[2];
                                     $message = __('Problems upgrading the database');
                                     $error = 5;
                                     // Problems upgrading the database
                                 }
                             } else {
                                 $message = __('Problems copying files. Maybe permissions are not correct');
                                 $error = 4;
                                 // Problems copying files. Maybe permissions are not correct
                             }
                         } else {
                             $message = __('Nothing to copy');
                             $error = 99;
                             // Nothing to copy. THIS SHOULD NEVER HAPPENS, means we dont update any file!
                         }
                     } else {
                         $message = __('Unzip failed');
                         $error = 3;
                         // Unzip failed
                     }
                 } else {
                     $message = __('Download failed');
                     $error = 2;
                     // Download failed
                 }
             } else {
                 $message = __('Missing download URL');
                 $error = 1;
                 // Missing download URL
             }
             if ($remove_error_msg != '') {
                 if ($error == 0) {
                     $message .= "<br /><br />" . __('We had some errors removing files, those are not super-sensitive errors, so we continued upgrading your installation. Please remove the following files (you already have OSClass upgraded, but to ensure maximun performance)');
                 }
             }
             if ($error == 5) {
                 $message .= "<br /><br />" . __('We had some errors upgrading your database. The follwing queries failed') . implode("<br />", $sql_error_msg);
             }
             echo $message;
             foreach ($perms as $k => $v) {
                 @chmod($k, $v);
             }
             break;
         default:
             echo json_encode(array('error' => __('no action defined')));
             break;
     }
     // clear all keep variables into session
     Session::newInstance()->_dropKeepForm();
     Session::newInstance()->_clearVariables();
 }
예제 #4
0
        </script>
        <script type="text/javascript" src="<?php 
echo osc_current_admin_theme_url();
?>
js/datatables.post_init.js"></script>
        <div id="content">
            <div id="separator"></div>
            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
            <div id="right_column">
                <div id="content_header" class="content_header">
                    <div id="content_header" class="content_header">
                        <div style="float: left;">
                            <img src="<?php 
echo osc_current_admin_theme_url();
?>
images/currencies.gif" title="" alt="" />
                        </div>
                        <div id="content_header_arrow">&raquo; <?php 
_e('Currencies');
?>
</div>
                        <a href="<?php 
echo osc_admin_base_url(true);
?>
?page=settings&amp;action=currencies&amp;type=add" id="button_open"><?php 
_e('Add');
?>
</a>
                        <div style="clear: both;"></div>
예제 #5
0
파일: index.php 프로젝트: semul/Osclass
        </script>
    <?php 
}
osc_add_hook('admin_header', 'customHead');
osc_current_admin_theme_path('parts/header.php');
?>
    
    <div id="backup-settings">
        <h2 class="render-title"><?php 
_e('Upgrade');
?>
</h2>
        <div id="result">
            <div id="output" style="display:none">
                <img id="loading_immage" src="<?php 
echo osc_current_admin_theme_url('images/loading.gif');
?>
" title="" alt="" />
                <?php 
_e('Upgrading your OSClass installation (this could take a while): ', 'admin');
?>
            </div>
            <div id="tohide">
                <p>
                    <?php 
_e('You have uploaded a new version of OSClass, you need to upgrade OSClass for it to work correctly.');
?>
                </p>
                <a class="btn" href="<?php 
echo osc_admin_base_url(true);
?>
예제 #6
0
파일: index.php 프로젝트: mylastof/os-class
function customHead()
{
    ?>
        <script type="text/javascript">
            document.write('<style type="text/css">.tabber{ display:none; }</style>');
        </script>
        <style>
            .placeholder {
                background-color: #cfcfcf;
            }
            .footest .category_div {
                opacity: 0.8;
            }
            .list-categories li {
                opacity: 1 !important;
            }
            .category_div {
                background: #ffffff;
            }
            .alert-custom {
                background-color: #FDF5D9;
                border-bottom: 1px solid #EEDC94;
                color: #404040;
            }
            .cat-hover,
            .cat-hover .category_row{
                background-color:#fffccc !important;
                background:#fffccc !important;
            }
        </style>
        <script type="text/javascript">
            $(function() {
                $('.category_div').on('mouseenter',function(){
                    $(this).addClass('cat-hover');
                }).on('mouseleave',function(){
                    $(this).removeClass('cat-hover');
                });
                var list_original = '';

                $('.sortable').nestedSortable({
                    disableNesting: 'no-nest',
                    forcePlaceholderSize: true,
                    handle: '.handle',
                    helper: 'clone',
                    listType: 'ul',
                    items: 'li',
                    maxLevels: 4,
                    opacity: .6,
                    placeholder: 'placeholder',
                    revert: 250,
                    tabSize: 25,
                    tolerance: 'pointer',
                    toleranceElement: '> div',
                    create: function(event, ui) {
                    },
                    start: function(event, ui) {
                        list_original = $('.sortable').nestedSortable('serialize');
                        $(ui.helper).addClass('footest');
                        $(ui.helper).prepend('<div style="opacity: 1 !important; padding:5px;" class="alert-custom"><?php 
    echo osc_esc_js(__('Note: You must expand the category in order to make it a subcategory.'));
    ?>
</div>');
                    },
                    stop: function(event, ui) {

                        $(".jsMessage").fadeIn("fast");
                        $(".jsMessage p").attr('class', '');
                        $(".jsMessage p").html('<img height="16" width="16" src="<?php 
    echo osc_current_admin_theme_url('images/loading.gif');
    ?>
"> <?php 
    echo osc_esc_js(__('This action could take a while.'));
    ?>
');

                        var list = '';
                        list = $('.sortable').nestedSortable('serialize');
                        var array_list = $('.sortable').nestedSortable('toArray');
                        var l = array_list.length;
                        for(var k = 0; k < l; k++ ) {
                            if( array_list[k].item_id == $(ui.item).find('div').attr('category_id') ) {
                                if( array_list[k].parent_id == 'root' ) {
                                    $(ui.item).closest('.toggle').show();
                                }
                                break;
                            }
                        }
                        if( !$(ui.item).parent().hasClass('sortable') ) {
                            $(ui.item).parent().addClass('subcategory');
                        }
                        if(list_original != list) {
                            var plist = array_list.reduce(function ( total, current, index ) {
                                total[index] = {'c' : current.item_id, 'p' : current.parent_id};
                                return total;
                            }, {});
                            $.ajax({
                                type: 'POST',
                                url: "<?php 
    echo osc_admin_base_url(true) . "?page=ajax&action=categories_order&" . osc_csrf_token_url();
    ?>
",
                                data: {'list' : plist},
                                context: document.body,
                                success: function(res){
                                    var ret = eval( "(" + res + ")");
                                    var message = "";
                                    if( ret.error ) {
                                        $(".jsMessage p").attr('class', 'error');
                                        message += ret.error;
                                    }
                                    if( ret.ok ){
                                        $(".jsMessage p").attr('class', 'ok');
                                        message += ret.ok;
                                    }

                                    $(".jsMessage").show();
                                    $(".jsMessage p").html(message);
                                },
                                error: function(){
                                    $(".jsMessage").fadeIn("fast");
                                    $(".jsMessage p").attr('class', '');
                                    $(".jsMessage p").html('<?php 
    echo osc_esc_js(__('Ajax error, please try again.'));
    ?>
');
                                }
                            });

                            list_original = list;
                        }
                    }
                });

                $(".toggle").bind("click", function(e) {
                    var list = $(this).parents('li').first().find('ul');
                    var lili = $(this).closest('li').find('ul').find('li').find('ul');
                    var li   = $(this).closest('li').first();
                    if( $(this).hasClass('status-collapsed') ) {
                        $(li).removeClass('no-nest');
                        $(list).show();
                        $(lili).hide();
                        $(this).removeClass('status-collapsed').addClass('status-expanded');
                        $(this).html('-');
                    } else {
                        $(li).addClass('no-nest');
                        $(list).hide();
                        $(this).removeClass('status-expanded').addClass('status-collapsed');
                        $(this).html('+');
                    }
                });

                // dialog delete
                $("#dialog-delete-category").dialog({
                    autoOpen: false,
                    modal: true
                });
                $("#category-delete-submit").click(function() {
                    var id  = $("#dialog-delete-category").attr('data-category-id');
                    var url  = '<?php 
    echo osc_admin_base_url(true);
    ?>
?page=ajax&action=delete_category&<?php 
    echo osc_csrf_token_url();
    ?>
&id=' + id;

                    $.ajax({
                        url: url,
                        context: document.body,
                        success: function(res) {
                            var ret = eval( "(" + res + ")");
                            var message = "";
                            if( ret.error ) {
                                message += ret.error;
                                $(".jsMessage p").attr('class', 'error');
                            }
                            if( ret.ok ) {
                                message += ret.ok;
                                $(".jsMessage p").attr('class', 'ok');

                                $('#list_'+id).fadeOut("slow");
                                $('#list_'+id).remove();
                            }

                            $(".jsMessage").show();
                            $(".jsMessage p").html(message);
                        },
                        error: function() {
                            $(".jsMessage").show();
                            $(".jsMessage p").attr('class', '');
                            $(".jsMessage p").html("<?php 
    echo osc_esc_js(__('Ajax error, try again.'));
    ?>
");
                        }
                    });
                    $('#dialog-delete-category').dialog('close');
                    $('body,html').animate({
                        scrollTop: 0
                    }, 500);
                    return false;
                });
            });

            list_original = $('.sortable').nestedSortable('serialize');

            function show_iframe(class_name, id) {
                if($('.content_list_'+id+' .iframe-category').length == 0){
                    $('.iframe-category').remove();
                    var name = 'frame_'+ id;
                    var id_  = 'frame_'+ id;
                    var url  = '<?php 
    echo osc_admin_base_url(true);
    ?>
?page=ajax&action=category_edit_iframe&id=' + id;
                    $.ajax({
                        url: url,
                        context: document.body,
                        success: function(res){
                            $('div.' + class_name).html(res);
                            $('div.' + class_name).fadeIn("fast");
                        }
                    });
                } else {
                    $('.iframe-category').remove();
                }
                return false;
            }

            function delete_category(id) {
                $("#dialog-delete-category").attr('data-category-id', id);
                $("#dialog-delete-category").dialog('open');
                return false;
            }

            function enable_cat(id) {
                var enabled;

                $(".jsMessage").fadeIn("fast");
                $(".jsMessage p").attr('class', '');
                $(".jsMessage p").html('<img height="16" width="16" src="<?php 
    echo osc_current_admin_theme_url('images/loading.gif');
    ?>
"> <?php 
    echo osc_esc_js(__('This action could take a while.'));
    ?>
');

                if( $('div[category_id=' + id + ']').hasClass('disabled') ) {
                    enabled = 1;
                } else {
                    enabled = 0;
                }

                var url  = '<?php 
    echo osc_admin_base_url(true);
    ?>
?page=ajax&action=enable_category&<?php 
    echo osc_csrf_token_url();
    ?>
&id=' + id + '&enabled=' + enabled;
                $.ajax({
                    url: url,
                    context: document.body,
                    success: function(res) {
                        var ret = eval( "(" + res + ")");
                        var message = "";
                        if(ret.error) {
                            message += ret.error;
                            $(".jsMessage p").attr('class', 'error');
                        }
                        if(ret.ok) {
                            if( enabled == 0 ) {
                                $('div[category_id=' + id + ']').addClass('disabled');
                                $('div[category_id=' + id + ']').removeClass('enabled');
                                $('div[category_id=' + id + ']').find('a.enable').text('<?php 
    _e('Enable');
    ?>
');
                                for(var i = 0; i < ret.affectedIds.length; i++) {
                                    id =  ret.affectedIds[i].id;
                                    $('div[category_id=' + id + ']').addClass('disabled');
                                    $('div[category_id=' + id + ']').removeClass('enabled');
                                    $('div[category_id=' + id + ']').find('a.enable').text('<?php 
    _e('Enable');
    ?>
');
                                }
                            } else {
                                $('div[category_id=' + id + ']').removeClass('disabled');
                                $('div[category_id=' + id + ']').addClass('enabled');
                                $('div[category_id=' + id + ']').find('a.enable').text('<?php 
    _e('Disable');
    ?>
');

                                for(var i = 0; i < ret.affectedIds.length; i++) {
                                    id =  ret.affectedIds[i].id;
                                    $('div[category_id=' + id + ']').removeClass('disabled');
                                    $('div[category_id=' + id + ']').addClass('enabled');
                                    $('div[category_id=' + id + ']').find('a.enable').text('<?php 
    _e('Disable');
    ?>
');
                                }
                            }

                            message += ret.ok;
                            $(".jsMessage p").attr('class', 'ok');
                        }

                        $(".jsMessage").show();
                        $(".jsMessage p").html(message);
                    },
                    error: function(){
                        $(".jsMessage").show();
                        $(".jsMessage p").attr('class', '');
                        $(".jsMessage p").html("<?php 
    echo osc_esc_js(__('Ajax error, try again.'));
    ?>
");
                    }
                });
            }
        </script>
        <?php 
}
예제 #7
0
function drawMarketItem($item, $color = false)
{
    //constants
    $updateClass = '';
    $updateData = '';
    $thumbnail = false;
    $featuredClass = '';
    $style = '';
    $letterDraw = '';
    $compatible = '';
    $type = strtolower($item['e_type']);
    $items_to_update = json_decode(osc_get_preference($type . 's_to_update'), true);
    $items_downloaded = json_decode(osc_get_preference($type . 's_downloaded'), true);
    if ($item['s_thumbnail']) {
        $thumbnail = $item['s_thumbnail'];
    }
    if ($item['s_banner']) {
        if (@$item['s_banner_path'] != '') {
            $thumbnail = $item['s_banner_path'] . $item['s_banner'];
        } else {
            $thumbnail = 'http://market.osclass.org/oc-content/uploads/market/' . $item['s_banner'];
        }
    }
    $downloaded = false;
    if (in_array($item['s_update_url'], $items_downloaded)) {
        if (in_array($item['s_update_url'], $items_to_update)) {
            $updateClass = 'has-update';
            $updateData = ' data-update="true"';
        } else {
            // market item downloaded !
            $downloaded = true;
        }
    }
    //Check if is compatibleosc_version()
    if ($type == 'language') {
        if (!check_market_language_compatibility($item['s_update_url'], $item['s_version'])) {
            $compatible = ' not-compatible';
        }
    } else {
        if (!check_market_compatibility($item['s_compatible'], $type)) {
            $compatible = ' not-compatible';
        }
    }
    if (!$thumbnail && $color) {
        $thumbnail = osc_current_admin_theme_url('images/gr-' . $color . '.png');
        $letterDraw = $item['s_update_url'][0];
        if ($type == 'language') {
            $letterDraw = $item['s_update_url'];
        }
    }
    if ($item['b_featured']) {
        $featuredClass = ' is-featured';
        if ($downloaded || $updateClass) {
            $featuredClass .= '-';
        }
    }
    if ($downloaded) {
        $featuredClass .= 'is-downloaded';
    }
    $buyClass = '';
    if ($item['i_price'] != '' && (double) $item['i_price'] > 0 && $item['b_paid'] == 1) {
        $buyClass = ' is-buy ';
    }
    $style = 'background-image:url(' . $thumbnail . ');';
    echo '<a href="#' . $item['s_update_url'] . '" class="mk-item-parent ' . $featuredClass . $updateClass . $compatible . $buyClass . '" data-type="' . $type . '"' . $updateData . ' data-gr="' . $color . '" data-letter="' . $item['s_update_url'][0] . '">';
    echo '<div class="mk-item mk-item-' . $type . '">';
    echo '    <div class="banner" style="' . $style . '">' . $letterDraw . '</div>';
    echo '    <div class="mk-info"><i class="flag"></i>';
    echo '        <h3>' . $item['s_title'] . '</h3>';
    echo '        <span class="downloads"><strong>' . $item['i_total_downloads'] . '</strong> ' . __('downloads') . '</span>';
    echo '        <i>by ' . $item['s_contact_name'] . '</i>';
    echo '        <div class="market-actions">';
    echo '            <span class="more">' . __('View more') . '</span>';
    if ($item['i_price'] != '' && (double) $item['i_price'] > 0 && $item['b_paid'] == 0) {
        echo '            <span class="buy-btn' . $compatible . '" data-code="' . $item['s_buy_url'] . '" data-type="' . $type . '"' . '>' . sprintf(__('Buy $%s'), number_format($item['i_price'] / 1000000, 0, '.', ',')) . '</span>';
    } else {
        echo '            <span class="download-btn' . $compatible . '" data-code="' . $item['s_update_url'] . '" data-type="' . $type . '"' . '>' . __('Download') . '</span>';
    }
    echo '        </div>';
    echo '    </div>';
    echo '</div>';
    echo '</a>';
}
예제 #8
0
        </script>
        <script type="text/javascript" src="<?php 
echo osc_current_admin_theme_url('js/datatables.post_init.js');
?>
"></script>
        <div id="content">
            <div id="separator"></div>
            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
            <div id="right_column">
                <div id="content_header" class="content_header">
                    <div id="content_header" class="content_header">
                        <div style="float: left;">
                            <img src="<?php 
echo osc_current_admin_theme_url('images/currencies.gif');
?>
" title="" alt="" />
                        </div>
                        <div id="content_header_arrow">&raquo; <?php 
_e('Currencies');
?>
</div>
                        <a href="<?php 
echo osc_admin_base_url(true);
?>
?page=settings&amp;action=currencies&amp;type=add" id="button_open"><?php 
_e('Add');
?>
</a>
                        <div style="clear: both;"></div>
예제 #9
0
 function doModel()
 {
     //specific things for this class
     switch ($this->action) {
         case 'bulk_actions':
             break;
         case 'regions':
             //Return regions given a countryId
             $regions = Region::newInstance()->findByCountry(Params::getParam("countryId"));
             echo json_encode($regions);
             break;
         case 'cities':
             //Returns cities given a regionId
             $cities = City::newInstance()->findByRegion(Params::getParam("regionId"));
             echo json_encode($cities);
             break;
         case 'location':
             // This is the autocomplete AJAX
             $cities = City::newInstance()->ajax(Params::getParam("term"));
             echo json_encode($cities);
             break;
         case 'userajax':
             // This is the autocomplete AJAX
             $users = User::newInstance()->ajax(Params::getParam("term"));
             if (count($users) == 0) {
                 echo json_encode(array(0 => array('id' => '', 'label' => __('No results'), 'value' => __('No results'))));
             } else {
                 echo json_encode($users);
             }
             break;
         case 'date_format':
             echo json_encode(array('format' => Params::getParam('format'), 'str_formatted' => osc_format_date(date(Params::getParam('format')))));
             break;
         case 'runhook':
             // run hooks
             $hook = Params::getParam('hook');
             if ($hook == '') {
                 echo json_encode(array('error' => 'hook parameter not defined'));
                 break;
             }
             switch ($hook) {
                 case 'item_form':
                     osc_run_hook('item_form', Params::getParam('catId'));
                     break;
                 case 'item_edit':
                     $catId = Params::getParam("catId");
                     $itemId = Params::getParam("itemId");
                     osc_run_hook("item_edit", $catId, $itemId);
                     break;
                 default:
                     osc_run_hook('ajax_admin_' . $hook);
                     break;
             }
             break;
         case 'items':
             // Return items (use external file oc-admin/ajax/item_processing.php)
             require_once osc_admin_base_path() . 'ajax/items_processing.php';
             $items_processing = new ItemsProcessingAjax(Params::getParamsAsArray("get"));
             break;
         case 'users':
             // Return items (use external file oc-admin/ajax/item_processing.php)
             require_once osc_admin_base_path() . 'ajax/users_processing.php';
             $users_processing = new UsersProcessingAjax(Params::getParamsAsArray("get"));
             break;
         case 'media':
             // Return items (use external file oc-admin/ajax/media_processing.php)
             require_once osc_admin_base_path() . 'ajax/media_processing.php';
             $media_processing = new MediaProcessingAjax(Params::getParamsAsArray("get"));
             break;
         case 'categories_order':
             // Save the order of the categories
             $aIds = Params::getParam('list');
             $orderParent = 0;
             $orderSub = 0;
             $catParent = 0;
             $error = 0;
             $catManager = Category::newInstance();
             $aRecountCat = array();
             foreach ($aIds as $id => $parent) {
                 if ($parent == 'root') {
                     $res = $catManager->updateOrder($id, $orderParent);
                     if (is_bool($res) && !$res) {
                         $error = 1;
                     }
                     // find category
                     $auxCategory = Category::newInstance()->findByPrimaryKey($id);
                     // set parent category
                     $conditions = array('pk_i_id' => $id);
                     $array['fk_i_parent_id'] = NULL;
                     $res = $catManager->update($array, $conditions);
                     if (is_bool($res) && !$res) {
                         $error = 1;
                     } else {
                         if ($res == 1) {
                             // updated ok
                             $parentId = $auxCategory['fk_i_parent_id'];
                             if ($parentId) {
                                 // update parent category stats
                                 array_push($aRecountCat, $id);
                                 array_push($aRecountCat, $parentId);
                             }
                         }
                     }
                     $orderParent++;
                 } else {
                     if ($parent != $catParent) {
                         $catParent = $parent;
                         $orderSub = 0;
                     }
                     $res = $catManager->updateOrder($id, $orderSub);
                     if (is_bool($res) && !$res) {
                         $error = 1;
                     }
                     // set parent category
                     $auxCategory = Category::newInstance()->findByPrimaryKey($id);
                     $auxCategoryP = Category::newInstance()->findByPrimaryKey($catParent);
                     $conditions = array('pk_i_id' => $id);
                     $array['fk_i_parent_id'] = $catParent;
                     $res = $catManager->update($array, $conditions);
                     if (is_bool($res) && !$res) {
                         $error = 1;
                     } else {
                         if ($res == 1) {
                             // updated ok
                             // update category parent
                             $prevParentId = $auxCategory['fk_i_parent_id'];
                             $parentId = $auxCategoryP['pk_i_id'];
                             array_push($aRecountCat, $prevParentId);
                             array_push($aRecountCat, $parentId);
                         }
                     }
                     $orderSub++;
                 }
             }
             // update category stats
             foreach ($aRecountCat as $rId) {
                 osc_update_cat_stats_id($rId);
             }
             if ($error) {
                 $result = array('error' => __("Some error ocurred"));
             } else {
                 $result = array('ok' => __("Order saved"));
             }
             echo json_encode($result);
             break;
         case 'category_edit_iframe':
             $this->_exportVariableToView('category', Category::newInstance()->findByPrimaryKey(Params::getParam("id")));
             $this->_exportVariableToView('languages', OSCLocale::newInstance()->listAllEnabled());
             $this->doView("categories/iframe.php");
             break;
         case 'field_categories_iframe':
             $selected = Field::newInstance()->categories(Params::getParam("id"));
             if ($selected == null) {
                 $selected = array();
             }
             $this->_exportVariableToView("selected", $selected);
             $this->_exportVariableToView("field", Field::newInstance()->findByPrimaryKey(Params::getParam("id")));
             $this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
             $this->doView("fields/iframe.php");
             break;
         case 'field_categories_post':
             $error = 0;
             $field = Field::newInstance()->findByName(Params::getParam("s_name"));
             if (!isset($field['pk_i_id']) || isset($field['pk_i_id']) && $field['pk_i_id'] == Params::getParam("id")) {
                 // remove categories from a field
                 Field::newInstance()->cleanCategoriesFromField(Params::getParam("id"));
                 // no error... continue updating fields
                 if ($error == 0) {
                     $slug = Params::getParam("field_slug") != '' ? Params::getParam("field_slug") : Params::getParam("s_name");
                     $slug_tmp = $slug = preg_replace('|([-]+)|', '-', preg_replace('|[^a-z0-9_-]|', '-', strtolower($slug)));
                     $slug_k = 0;
                     while (true) {
                         $field = Field::newInstance()->findBySlug($slug);
                         if (!$field || $field['pk_i_id'] == Params::getParam("id")) {
                             break;
                         } else {
                             $slug_k++;
                             $slug = $slug_tmp . "_" . $slug_k;
                         }
                     }
                     $res = Field::newInstance()->update(array('s_name' => Params::getParam("s_name"), 'e_type' => Params::getParam("field_type"), 's_slug' => $slug, 'b_required' => Params::getParam("field_required") == "1" ? 1 : 0, 's_options' => Params::getParam('s_options')), array('pk_i_id' => Params::getParam("id")));
                     if (is_bool($res) && !$res) {
                         $error = 1;
                     }
                 }
                 // no error... continue inserting categories-field
                 if ($error == 0) {
                     $aCategories = Params::getParam("categories");
                     if (is_array($aCategories) && count($aCategories) > 0) {
                         $res = Field::newInstance()->insertCategories(Params::getParam("id"), $aCategories);
                         if (!$res) {
                             $error = 1;
                         }
                     }
                 }
                 // error while updating?
                 if ($error == 1) {
                     $message = __("Error while updating.");
                 }
             } else {
                 $error = 1;
                 $message = __("Sorry, you already have one field with that name");
             }
             if ($error) {
                 $result = array('error' => $message);
             } else {
                 $result = array('ok' => __("Saved"), 'text' => Params::getParam("s_name"), 'field_id' => $field['pk_i_id']);
             }
             echo json_encode($result);
             break;
         case 'delete_field':
             $id = Params::getParam("id");
             $error = 0;
             $fieldManager = Field::newInstance();
             $res = $fieldManager->deleteByPrimaryKey($id);
             if ($res > 0) {
                 $message = __('The custom field have been deleted');
             } else {
                 $error = 1;
                 $message = __('Error while deleting');
             }
             if ($error) {
                 $result = array('error' => $message);
             } else {
                 $result = array('ok' => __("Saved"));
             }
             echo json_encode($result);
             break;
         case 'add_field':
             $s_name = __('NEW custom field');
             $slug_tmp = $slug = preg_replace('|([-]+)|', '-', preg_replace('|[^a-z0-9_-]|', '-', strtolower($s_name)));
             $slug_k = 0;
             while (true) {
                 $field = Field::newInstance()->findBySlug($slug);
                 if (!$field || $field['pk_i_id'] == Params::getParam("id")) {
                     break;
                 } else {
                     $slug_k++;
                     $slug = $slug_tmp . "_" . $slug_k;
                 }
             }
             $fieldManager = Field::newInstance();
             $result = $fieldManager->insertField($s_name, 'TEXT', $slug, 0, '', array());
             if ($result) {
                 echo json_encode(array('error' => 0, 'field_id' => $fieldManager->dao->insertedId(), 'field_name' => $s_name));
             } else {
                 echo json_encode(array('error' => 1));
             }
             break;
         case 'enable_category':
             $id = strip_tags(Params::getParam('id'));
             $enabled = Params::getParam('enabled') != '' ? Params::getParam('enabled') : 0;
             $error = 0;
             $result = array();
             $aUpdated = array();
             $mCategory = Category::newInstance();
             $aCategory = $mCategory->findByPrimaryKey($id);
             if ($aCategory == false) {
                 $result = array('error' => sprintf(__("It doesn't exist a category with this id: %d"), $id));
                 echo json_encode($result);
                 break;
             }
             // root category
             if ($aCategory['fk_i_parent_id'] == '') {
                 $mCategory->update(array('b_enabled' => $enabled), array('pk_i_id' => $id));
                 $mCategory->update(array('b_enabled' => $enabled), array('fk_i_parent_id' => $id));
                 $subCategories = $mCategory->findSubcategories($id);
                 $aIds = array($id);
                 $aUpdated[] = array('id' => $id);
                 foreach ($subCategories as $subcategory) {
                     $aIds[] = $subcategory['pk_i_id'];
                     $aUpdated[] = array('id' => $subcategory['pk_i_id']);
                 }
                 Item::newInstance()->enableByCategory($enabled, $aIds);
                 if ($enabled) {
                     $result = array('ok' => __('The category and its subcategories have been enabled'));
                 } else {
                     $result = array('ok' => __('The category and its subcategories have been disabled'));
                 }
                 $result['affectedIds'] = $aUpdated;
                 echo json_encode($result);
                 break;
             }
             // subcategory
             $parentCategory = $mCategory->findRootCategory($id);
             if (!$parentCategory['b_enabled']) {
                 $result = array('error' => __('Parent category is disabled, you can not enable that category'));
                 echo json_encode($result);
                 break;
             }
             $mCategory->update(array('b_enabled' => $enabled), array('pk_i_id' => $id));
             if ($enabled) {
                 $result = array('ok' => __('The subcategory has been enabled'));
             } else {
                 $result = array('ok' => __('The subcategory has been disabled'));
             }
             $result['affectedIds'] = array(array('id' => $id));
             echo json_encode($result);
             break;
         case 'delete_category':
             $id = Params::getParam("id");
             $error = 0;
             $categoryManager = Category::newInstance();
             $res = $categoryManager->deleteByPrimaryKey($id);
             if ($res > 0) {
                 $message = __('The categories have been deleted');
             } else {
                 $error = 1;
                 $message = __('Error while deleting');
             }
             if ($error) {
                 $result = array('error' => $message);
             } else {
                 $result = array('ok' => __("Saved"));
             }
             echo json_encode($result);
             break;
         case 'edit_category_post':
             $id = Params::getParam("id");
             $fields['i_expiration_days'] = Params::getParam("i_expiration_days") != '' ? Params::getParam("i_expiration_days") : 0;
             $error = 0;
             $has_one_title = 0;
             $postParams = Params::getParamsAsArray();
             foreach ($postParams as $k => $v) {
                 if (preg_match('|(.+?)#(.+)|', $k, $m)) {
                     if ($m[2] == 's_name') {
                         if ($v != "") {
                             $has_one_title = 1;
                             $aFieldsDescription[$m[1]][$m[2]] = $v;
                             $s_text = $v;
                         } else {
                             $aFieldsDescription[$m[1]][$m[2]] = ' ';
                             $error = 1;
                         }
                     } else {
                         $aFieldsDescription[$m[1]][$m[2]] = $v;
                     }
                 }
             }
             $l = osc_language();
             if ($error == 0 || $error == 1 && $has_one_title == 1) {
                 $categoryManager = Category::newInstance();
                 $res = $categoryManager->updateByPrimaryKey(array('fields' => $fields, 'aFieldsDescription' => $aFieldsDescription), $id);
                 if (is_bool($res)) {
                     $error = 2;
                 }
             }
             if ($error == 0) {
                 $msg = __("Category updated correctly");
             } else {
                 if ($error == 1) {
                     if ($has_one_title == 1) {
                         $error = 4;
                         $msg = __('Category updated correctly, but some titles were empty');
                     } else {
                         $msg = __('Sorry, at least a title is needed');
                     }
                 } else {
                     if ($error == 2) {
                         $msg = __('Error while updating');
                     }
                 }
             }
             echo json_encode(array('error' => $error, 'msg' => $msg, 'text' => $aFieldsDescription[$l]['s_name']));
             break;
         case 'custom':
             // Execute via AJAX custom file
             $ajaxFile = Params::getParam("ajaxfile");
             if ($ajaxFile == '') {
                 echo json_encode(array('error' => 'no action defined'));
                 break;
             }
             // valid file?
             if (stripos($ajaxFile, '../') !== false) {
                 echo json_encode(array('error' => 'no valid ajaxFile'));
                 break;
             }
             if (!file_exists(osc_plugins_path() . $ajaxFile)) {
                 echo json_encode(array('error' => "ajaxFile doesn't exist"));
                 break;
             }
             require_once osc_plugins_path() . $ajaxFile;
             break;
         case 'test_mail':
             $title = sprintf(__('Test email, %s'), osc_page_title());
             $body = __("Test email") . "<br><br>" . osc_page_title();
             $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
             $array = array();
             if (osc_sendMail($emailParams)) {
                 $array = array('status' => '1', 'html' => __('Email sent successfully'));
             } else {
                 $array = array('status' => '0', 'html' => __('An error has occurred while sending email'));
             }
             echo json_encode($array);
             break;
         case 'order_pages':
             $order = Params::getParam("order");
             $id = Params::getParam("id");
             if ($order != '' && $id != '') {
                 $mPages = Page::newInstance();
                 $actual_page = $mPages->findByPrimaryKey($id);
                 $actual_order = $actual_page['i_order'];
                 $array = array();
                 $condition = array();
                 $new_order = $actual_order;
                 if ($order == 'up') {
                     $page = $mPages->findPrevPage($actual_order);
                 } else {
                     if ($order == 'down') {
                         $page = $mPages->findNextPage($actual_order);
                     }
                 }
                 if (isset($page['i_order'])) {
                     $mPages->update(array('i_order' => $page['i_order']), array('pk_i_id' => $id));
                     $mPages->update(array('i_order' => $actual_order), array('pk_i_id' => $page['pk_i_id']));
                 }
                 // TO BE IMPROVED
                 // json for datatables
                 $prefLocale = osc_current_user_locale();
                 $this->_exportVariableToView('pages', $mPages->listAll(0));
                 $o_json = array();
                 while (osc_has_static_pages()) {
                     $row = array();
                     $page = osc_static_page();
                     $content = array();
                     if (isset($page['locale'][$prefLocale]) && !empty($page['locale'][$prefLocale]['s_title'])) {
                         $content = $page['locale'][$prefLocale];
                     } else {
                         $content = current($page['locale']);
                     }
                     $options = array();
                     $options[] = '<a href="' . osc_static_page_url() . '">' . __('View page') . '</a>';
                     $options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&amp;action=edit&amp;id=' . osc_static_page_id() . '">' . __('Edit') . '</a>';
                     if (!$page['b_indelible']) {
                         $options[] = '<a onclick="javascript:return confirm(\'' . osc_esc_js("This action can't be undone. Are you sure you want to continue?") . '\')" href="' . osc_admin_base_url(true) . '?page=pages&amp;action=delete&amp;id=' . osc_static_page_id() . '">' . __('Delete') . '</a>';
                     }
                     $row[] = '<input type="checkbox" name="id[]"" value="' . osc_static_page_id() . '"" />';
                     $row[] = $page['s_internal_name'] . '<div id="datatables_quick_edit" style="display: none;">' . implode(' &middot; ', $options) . '</div>';
                     $row[] = $content['s_title'];
                     $row[] = osc_static_page_order() . ' <img id="up" onclick="order_up(' . osc_static_page_id() . ');" style="cursor:pointer; width:15px; height:15px;" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '"/> <br/><img id="down" onclick="order_down(' . osc_static_page_id() . ');" style="cursor:pointer; width:15px; height:15px; margin-left: 10px;" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '"/>';
                     $o_json[] = $row;
                 }
                 echo json_encode($o_json);
             }
             break;
             /******************************
              ** COMPLETE UPGRADE PROCESS **
              ******************************/
         /******************************
          ** COMPLETE UPGRADE PROCESS **
          ******************************/
         case 'upgrade':
             // AT THIS POINT WE KNOW IF THERE'S AN UPDATE OR NOT
             $message = "";
             $error = 0;
             $sql_error_msg = "";
             $rm_errors = 0;
             $perms = osc_save_permissions();
             osc_change_permissions();
             $maintenance_file = ABS_PATH . '.maintenance';
             $fileHandler = @fopen($maintenance_file, 'w');
             fclose($fileHandler);
             /***********************
              **** DOWNLOAD FILE ****
              ***********************/
             $data = osc_file_get_contents("http://osclass.org/latest_version.php");
             $data = json_decode(substr($data, 1, strlen($data) - 3), true);
             $source_file = $data['url'];
             if ($source_file != '') {
                 $tmp = explode("/", $source_file);
                 $filename = end($tmp);
                 $result = osc_downloadFile($source_file, $filename);
                 if ($result) {
                     // Everything is OK, continue
                     /**********************
                      ***** UNZIP FILE *****
                      **********************/
                     @mkdir(ABS_PATH . 'oc-temp', 0777);
                     $res = osc_unzip_file(osc_content_path() . 'downloads/' . $filename, ABS_PATH . 'oc-temp/');
                     if ($res == 1) {
                         // Everything is OK, continue
                         /**********************
                          ***** COPY FILES *****
                          **********************/
                         $fail = -1;
                         if ($handle = opendir(ABS_PATH . 'oc-temp')) {
                             $fail = 0;
                             while (false !== ($_file = readdir($handle))) {
                                 if ($_file != '.' && $_file != '..' && $_file != 'remove.list' && $_file != 'upgrade.sql' && $_file != 'customs.actions') {
                                     $data = osc_copy(ABS_PATH . "oc-temp/" . $_file, ABS_PATH . $_file);
                                     if ($data == false) {
                                         $fail = 1;
                                     }
                                 }
                             }
                             closedir($handle);
                             if ($fail == 0) {
                                 // Everything is OK, continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = DBConnectionClass::newInstance();
                                     $c_db = $conn->getOsclassDb();
                                     $comm = new DBCommandClass($c_db);
                                     $error_queries = $comm->updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         define('AUTO_UPGRADE', true);
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
                                             if (!unlink($dir->getPathname())) {
                                                 $rm_errors++;
                                             }
                                         }
                                     }
                                     if (!rmdir($path)) {
                                         $rm_errors++;
                                     }
                                     $deleted = @unlink(ABS_PATH . '.maintenance');
                                     if ($rm_errors == 0) {
                                         $message = __('Everything was OK! Your OSClass installation is updated');
                                     } else {
                                         $message = __('Almost everything was OK! Your OSClass installation is updated, but there were some errors removing temporary files. Please, remove manually the "oc-temp" folder');
                                         $error = 6;
                                         // Some errors removing files
                                     }
                                 } else {
                                     $sql_error_msg = $error_queries[2];
                                     $message = __('Problems upgrading the database');
                                     $error = 5;
                                     // Problems upgrading the database
                                 }
                             } else {
                                 $message = __('Problems copying files. Maybe permissions are not correct');
                                 $error = 4;
                                 // Problems copying files. Maybe permissions are not correct
                             }
                         } else {
                             $message = __('Nothing to copy');
                             $error = 99;
                             // Nothing to copy. THIS SHOULD NEVER HAPPENS, means we dont update any file!
                         }
                     } else {
                         $message = __('Unzip failed');
                         $error = 3;
                         // Unzip failed
                     }
                 } else {
                     $message = __('Download failed');
                     $error = 2;
                     // Download failed
                 }
             } else {
                 $message = __('Missing download URL');
                 $error = 1;
                 // Missing download URL
             }
             if ($error == 5) {
                 $message .= "<br /><br />" . __('We had some errors upgrading your database. The follwing queries failed') . implode("<br />", $sql_error_msg);
             }
             echo $message;
             foreach ($perms as $k => $v) {
                 @chmod($k, $v);
             }
             break;
         case 'location_stats':
             $workToDo = LocationsTmp::newInstance()->count();
             if ($workToDo > 0) {
                 // there are wotk to do
                 $aLocations = LocationsTmp::newInstance()->getLocations(1000);
                 foreach ($aLocations as $location) {
                     $id = $location['id_location'];
                     $type = $location['e_type'];
                     $data = 0;
                     // update locations stats
                     switch ($type) {
                         case 'COUNTRY':
                             $numItems = CountryStats::newInstance()->calculateNumItems($id);
                             $data = CountryStats::newInstance()->setNumItems($id, $numItems);
                             unset($numItems);
                             break;
                         case 'REGION':
                             $numItems = RegionStats::newInstance()->calculateNumItems($id);
                             $data = RegionStats::newInstance()->setNumItems($id, $numItems);
                             unset($numItems);
                             break;
                         case 'CITY':
                             $numItems = CityStats::newInstance()->calculateNumItems($id);
                             $data = CityStats::newInstance()->setNumItems($id, $numItems);
                             unset($numItems);
                             break;
                         default:
                             break;
                     }
                     if ($data >= 0) {
                         LocationsTmp::newInstance()->delete(array('e_type' => $location['e_type'], 'id_location' => $location['id_location']));
                     }
                 }
                 $array['status'] = 'more';
                 $array['pending'] = $workToDo = LocationsTmp::newInstance()->count();
                 echo json_encode($array);
             } else {
                 $array['status'] = 'done';
                 echo json_encode($array);
             }
             break;
         default:
             echo json_encode(array('error' => __('no action defined')));
             break;
     }
     // clear all keep variables into session
     Session::newInstance()->_dropKeepForm();
     Session::newInstance()->_clearVariables();
 }
예제 #10
0
파일: header.php 프로젝트: acharei/OSClass
</a><!-- &crarr; --></em>
    <div id="user_links"><?php 
_e('Hi');
?>
, <a title="<?php 
_e('Your profile');
?>
" href="<?php 
echo osc_admin_base_url(true);
?>
?page=admins&action=edit"><?php 
echo osc_logged_admin_username();
?>
!</a> | <a title="<?php 
_e('Log Out');
?>
" href="index.php?action=logout"><?php 
_e('Log Out');
?>
</a></div>
    <?php 
osc_run_hook('admin_header');
?>
</div>
<div id="static"> <a style="text-decoration:none;" target="_blank" href="http://admin.osclass.org/feedback.php"><img style="border:0px;" alt="<?php 
_e('Feedback');
?>
" src="<?php 
echo osc_current_admin_theme_url('images/feedback_button_new.gif');
?>
"></a> </div>
예제 #11
0
function customHead()
{
    ?>
        <script type="text/javascript">
            $(document).ready(function() {
                $("#steps_div").hide();
            });
        <?php 
    $perms = osc_save_permissions();
    $ok = osc_change_permissions();
    foreach ($perms as $k => $v) {
        @chmod($k, $v);
    }
    if ($ok) {
        ?>
            $(function() {
                var steps_div = document.getElementById('steps_div');
                steps_div.style.display = '';
                var steps = document.getElementById('steps');
                var version = <?php 
        echo osc_version();
        ?>
;
                var fileToUnzip = '';
                steps.innerHTML += '<?php 
        echo osc_esc_js(sprintf(__('Checking for updates (Current version %s)'), osc_version()));
        ?>
 ';

                $.getJSON("http://osclass.org/latest_version_v1.php?callback=?", function(data) {
                    if(data.version <= version) {
                        steps.innerHTML += '<?php 
        echo osc_esc_js(__('Congratulations! Your Osclass installation is up to date!'));
        ?>
';
                    } else {
                        steps.innerHTML += '<?php 
        echo osc_esc_js(__('New version to update:'));
        ?>
 ' + data.version + "<br />";
                        <?php 
        if (Params::getParam('confirm') == 'true') {
            ?>
                            steps.innerHTML += '<img id="loading_image" src="<?php 
            echo osc_current_admin_theme_url('images/loading.gif');
            ?>
" /><?php 
            echo osc_esc_js(__('Upgrading your Osclass installation (this could take a while):'));
            ?>
';

                            var tempAr = data.url.split('/');
                            fileToUnzip = tempAr.pop();
                            $.getJSON('<?php 
            echo osc_admin_base_url(true);
            ?>
?page=ajax&action=upgrade&<?php 
            echo osc_csrf_token_url();
            ?>
' , function(data) {
                                if(data.error==0 || data.error==6) {
                                    window.location = "<?php 
            echo osc_admin_base_url(true);
            ?>
?page=tools&action=version";
                                }
                                var loading_image = document.getElementById('loading_image');
                                loading_image.style.display = "none";
                                steps.innerHTML += data.message+"<br />";
                            });
                        <?php 
        } else {
            ?>
                            steps.innerHTML += '<input type="button" value="<?php 
            echo osc_esc_html(__('Upgrade'));
            ?>
" onclick="window.location.href=\'<?php 
            echo osc_admin_base_url(true);
            ?>
?page=tools&action=upgrade&confirm=true\';" />';
                        <?php 
        }
        ?>
                    }
                });
            });
        <?php 
    }
    ?>
        </script>
        <?php 
}
예제 #12
0
",
                            "sWidth": "auto"
                        }
                    ],
                    "aoColumnDefs": [
                        {
                            "bVisible": false,
                            "aTargets": [ 0 ]
                        }
                    ],
                    "aaSorting": [[0, 'asc']]
                });
            });
        </script>
        <script type="text/javascript" src="<?php 
echo osc_current_admin_theme_url('js/datatables.post_init.js');
?>
"></script>
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
        <!-- container -->
        <div id="content">
            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
            <!-- right container -->
            <div class="right">
                <div class="header_title">
예제 #13
0
파일: frm.php 프로젝트: acharei/OSClass
                return true;
            }
        </script>
        <div id="content">
            <div id="separator"></div>

            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>

            <div id="right_column">
                <div id="content_header" class="content_header">
                    <div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/comments-icon2.png');
?>
" title="" alt=""/>
                    </div>
                    <div id="content_header_arrow">&raquo; <?php 
_e($title);
?>
</div>
                    <div style="clear: both;"></div>
                </div>

                <div id="content_separator"></div>
                <?php 
osc_show_flash_message('admin');
?>
예제 #14
0
                });
                $('#down').live('mouseover', function(event) {
                    $(this).attr('src', '<?php 
echo osc_current_admin_theme_url('images/arrow_down_dark.png');
?>
');
                });
                $('#up').live('mouseleave', function(event) {
                    $(this).attr('src', '<?php 
echo osc_current_admin_theme_url('images/arrow_up.png');
?>
');
                });
                $('#down').live('mouseleave', function(event) {
                    $(this).attr('src', '<?php 
echo osc_current_admin_theme_url('images/arrow_down.png');
?>
');
                });
            });
        </script>
        <script type="text/javascript" src="<?php 
echo osc_current_admin_theme_js_url('datatables.post_init.js');
?>
"></script>
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
        <!-- container -->
예제 #15
0
파일: media.php 프로젝트: acharei/OSClass
?>
        <div id="update_version" style="display:none;"></div>
        <div class="Header"><?php 
_e('Media settings');
?>
</div>
        <div id="content">
            <div id="separator"></div>
            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
            <div id="right_column">
                <div id="content_header" class="content_header">
                    <div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/media-config-icon.png');
?>
" title="" alt=""/>
                    </div>
                    <div id="content_header_arrow">&raquo; <?php 
_e('Configure media');
?>
</div>
                    <div style="clear: both;"></div>
                </div>
                <div id="content_separator"></div>
                <?php 
osc_show_flash_message('admin');
?>
                <div style="border: 1px solid #ccc; background: #eee;">
                    <div style="padding: 20px;">
예제 #16
0
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
?>

<!-- menu -->
<div id="left_column"> 
    <div style="padding-top: 9px;">
        <div style="float: left; padding-left: 5px; padding-top: 5px;">
            <img src="<?php 
echo osc_current_admin_theme_url('images/home_icon.gif');
?>
" alt="" title="" />
        </div>
        <div style="float: left; padding-top: 5px; padding-left: 5px;">&raquo; <a href="<?php 
echo osc_admin_base_url();
?>
"><?php 
_e('Dashboard');
?>
</a></div>
        <div style="clear: both;"></div>
        <div style="border-top: 1px solid #ccc; width: 99%;">&nbsp;</div>
    </div>

    <div id="menu">
예제 #17
0
                $(function() {
                    // other tweaks
                    $('#sortable_left').sortable({
                        connectWith: ["#sortable_right"], placeholder: 'widget-placeholder', containment: 'body'
                    });
                    $('#sortable_right').sortable({
                        connectWith: ["#sortable_left"], placeholder: 'widget-placeholder', containment: 'body'
                    });
                });
            </script>
            
			<div id="right_column">
			    <div id="content_header" class="content_header">
					<div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/home.png');
?>
" title="" alt=""/>
                    </div>
					<div id="content_header_arrow">&raquo; <?php 
_e('Dashboard');
?>
</div>
					<div id="button_open"><?php 
_e('Settings');
?>
</div>
					<div style="clear: both;"></div>
				</div>
				<?php 
osc_show_flash_message('admin');
예제 #18
0
파일: header.php 프로젝트: semul/Osclass
?>
">
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<?php 
echo osc_current_admin_theme_url('images/favicon-144.png');
?>
">
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<?php 
echo osc_current_admin_theme_url('images/favicon-114.png');
?>
">
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<?php 
echo osc_current_admin_theme_url('images/favicon-72.png');
?>
">
        <link rel="apple-touch-icon-precomposed" href="<?php 
echo osc_current_admin_theme_url('images/favicon-57.png');
?>
">

        <?php 
osc_run_hook('admin_header');
?>
    </head>
<body class="<?php 
echo implode(' ', osc_apply_filter('admin_body_class', array()));
?>
">
        <?php 
AdminToolbar::newInstance()->render();
?>
    </div>
예제 #19
0
파일: iframe.php 프로젝트: acharei/OSClass
                    var ret = eval( "(" + data + ")");
                  
                    var message = "";
                    if(ret.error==0 || ret.error==4) {
                        $('#settings_form').fadeOut('fast', function(){
                            $('#settings_form').remove();
                        });
                        message += '<img style="padding-right:5px;padding-top:2px;" src="<?php 
echo osc_current_admin_theme_url('images/tick.png');
?>
"/>';
                        message += ret.msg;
                        $('div#settings_form').parent().parent().find('.quick_edit').html(ret.text);
                    } else {
                        message += '<img style="padding-right:5px;padding-top:2px;" src="<?php 
echo osc_current_admin_theme_url('images/cross.png');
?>
"/>';
                        message += ret.msg; 

                    }

                    $("#jsMessage").fadeIn("fast");
                    $("#jsMessage").html(message);
                    setTimeout(function(){
                        $("#jsMessage").fadeOut("slow", function () {
                            $("#jsMessage").html("");
                        });
                    }, 3000);
                    $('div.content_list_<?php 
echo osc_category_id();
예제 #20
0
?>
        <div id="update_version" style="display:none;"></div>
        <div class="Header"><?php 
_e('Plugins');
?>
</div>              
	        <div id="content">
		        <div id="separator"></div>	
		        <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
	            <div id="right_column">
			        <div id="content_header" class="content_header">
				        <div style="float: left;">
                            <img src="<?php 
echo osc_current_admin_theme_url('images/plugins-icon.png');
?>
" title="" alt="" />
                        </div>
				        <div id="content_header_arrow">&raquo; <?php 
_e('Plugins');
?>
</div>
				        <a href="<?php 
echo osc_admin_base_url(true);
?>
?page=plugins&action=add" id="button_open"><?php 
_e('Add a new plugin');
?>
</a>
				        <div style="clear: both;"></div>
예제 #21
0
파일: frm.php 프로젝트: nsswaga/OSClass
?>
        <div id="content">
            <div id="separator"></div>

            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>

            <div id="right_column">
                <?php 
osc_show_flash_message('admin');
?>
                <div class="content_header" id="content_header">
                    <div style="float: left;">
                        <img alt="" title="" src="<?php 
echo osc_current_admin_theme_url('images/new-folder-icon.png');
?>
">
                    </div>
                    <div id="content_header_arrow">» <?php 
if ($new_item) {
    _e('New item');
} else {
    _e('Edit item');
}
?>
</div>
                    <div style="clear: both;"></div>
                </div>

                <div id="add_item_form" class="item-form">
예제 #22
0
파일: index.php 프로젝트: acharei/OSClass
                    <div id="jsMessage" class="" style="float:right;display:none;"></div>
                    <div style="clear: both;"></div>
                </div>
                <div id="content_separator"></div>
                <?php 
osc_show_flash_message('admin');
?>

                <div id="jsMessage" class="FlashMessage" style="display:none;"></div>

                <div style="clear: both;"></div>
                <div id="TableCategories" class="TableCategories">
                    <div style="padding-left:10px;">
                        <p>
                            <img src="<?php 
echo osc_current_admin_theme_url('images/question.png');
?>
" />
                            <?php 
_e('Drag&drop the categories to reorder them the way you like. Click on edit link to edit the category');
?>
.
                        </p>
                        <p style="padding-left: 20px;">
                            <strong class="publish_button">
                                <a href="<?php 
echo osc_admin_base_url(true);
?>
?page=categories&action=add_post_default">+ <?php 
_e('Add new category');
?>
예제 #23
0
파일: index.php 프로젝트: acharei/OSClass
?>
"></script>

        <div id="content">
            <div id="separator"></div>

            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>

            <div id="right_column">

                <div id="content_header" class="content_header">
                    <div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/icon-language.png');
?>
" title="" alt=""/>
                    </div>
                    <div id="content_header_arrow">&raquo; <?php 
_e('Languages');
?>
</div>
                    <a href="<?php 
echo osc_admin_base_url(true);
?>
?page=languages&action=add" id="button_open"><?php 
_e('Add');
?>
</a>
                    <div style="clear: both;"></div>
예제 #24
0
파일: frm.php 프로젝트: nsswaga/OSClass
                }
            });
        </script>
        <div id="content">
            <div id="separator"></div>
            <?php 
UserForm::location_javascript("admin");
?>
            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
            <div id="right_column">
                <div id="content_header" class="content_header">
                    <div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/user-group-icon.png');
?>
" title="" alt=""/>
                    </div>
                    <div id="content_header_arrow">&raquo; <?php 
echo $title;
?>
</div>
                    <div style="clear: both;"></div>
                </div>
                <div id="content_separator"></div>
                <!-- add new item form -->
                <div id="settings_form" style="border: 1px solid #ccc; background: #eee; ">
                    <div style="padding: 20px;">
                        <form action="<?php 
echo osc_admin_base_url(true);
예제 #25
0
파일: iframe.php 프로젝트: nsswaga/OSClass
                  
                    var message = "";
                    if(ret.error) {
                        message += '<img style="padding-right:5px;padding-top:2px;" src="<?php 
echo osc_current_admin_theme_url('images/cross.png');
?>
"/>';
                        message += ret.error; 

                    }
                    if(ret.ok){ 
                        $('#settings_form').fadeOut('fast', function(){
                            $('#settings_form').remove();
                        });
                        message += '<img style="padding-right:5px;padding-top:2px;" src="<?php 
echo osc_current_admin_theme_url('images/tick.png');
?>
"/>';
                        message += ret.ok;
                        $('div#settings_form').parent().parent().find('.quick_edit').html(ret.text);
                    }

                    $("#jsMessage").fadeIn("fast");
                    $("#jsMessage").html(message);
                    setTimeout(function(){
                        $("#jsMessage").fadeOut("slow", function () {
                            $("#jsMessage").html("");
                        });
                    }, 3000);
                    $('div.content_list_<?php 
echo osc_category_id();
예제 #26
0
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
        <div id="update_version" style="display:none;"></div>
		<div id="content">
			<div id="separator"></div>	
			<?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
		    <div id="right_column">
				<div id="content_header" class="content_header">
					<div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/settings-icon.png');
?>
" alt="" title=""/>
                    </div>
					<div id="content_header_arrow">&raquo; <?php 
_e('Currencies');
?>
</div> 
					<div style="clear: both;"></div>
				</div>
				<div id="content_separator"></div>
				<div id="settings_form" style="border: 1px solid #ccc; background: #eee;">
					<div style="padding: 20px;">
                        <form action="<?php 
echo osc_admin_base_url(true);
?>
예제 #27
0
 private function toArrayFormat()
 {
     $this->result['iTotalRecords'] = $this->total;
     $this->result['iTotalDisplayRecords'] = $this->total_filtered;
     $this->result['iDisplayLength'] = $this->_get['iDisplayLength'];
     $this->result['aaData'] = array();
     if (count($this->pages) == 0) {
         return;
     }
     $prefLocale = osc_current_user_locale();
     $count = 0;
     foreach ($this->pages as $aRow) {
         $row = array();
         $content = array();
         if (isset($aRow['locale'][$prefLocale]) && !empty($aRow['locale'][$prefLocale]['s_title'])) {
             $content = $aRow['locale'][$prefLocale];
         } else {
             $content = current($aRow['locale']);
         }
         // -- options --
         $options = array();
         View::newInstance()->_exportVariableToView('page', $aRow);
         $options[] = '<a href="' . osc_static_page_url() . '" target="_blank">' . __('View page') . '</a>';
         $options[] = '<a href="' . osc_admin_base_url(true) . '?page=pages&amp;action=edit&amp;id=' . $aRow['pk_i_id'] . '">' . __('Edit') . '</a>';
         if (!$aRow['b_indelible']) {
             $options[] = '<a onclick="return delete_dialog(\'' . $aRow['pk_i_id'] . '\');" href="' . osc_admin_base_url(true) . '?page=pages&amp;action=delete&amp;id=' . $aRow['pk_i_id'] . '">' . __('Delete') . '</a>';
         }
         $auxOptions = '<ul>' . PHP_EOL;
         foreach ($options as $actual) {
             $auxOptions .= '<li>' . $actual . '</li>' . PHP_EOL;
         }
         $actions = '<div class="actions">' . $auxOptions . '</div>' . PHP_EOL;
         $row[] = '<input type="checkbox" name="id[]"" value="' . $aRow['pk_i_id'] . '"" />';
         $row[] = $aRow['s_internal_name'] . $actions;
         $row[] = $content['s_title'];
         $row[] = '<div class="order-box">' . $aRow['i_order'] . ' <img class="up" onclick="order_up(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_up.png') . '" alt="' . __('Up') . '" title="' . __('Up') . '" />  <img class="down" onclick="order_down(' . $aRow['pk_i_id'] . ');" src="' . osc_current_admin_theme_url('images/arrow_down.png') . '" alt="' . __('Down') . '" title="' . __('Down') . '" /></div>';
         $this->result['aaData'][] = $row;
     }
 }
예제 #28
0
파일: add.php 프로젝트: acharei/OSClass
    </head>
    <body>
        <?php 
osc_current_admin_theme_path('header.php');
?>
        <div id="update_version" style="display:none;"></div>
        <div id="content">
            <div id="separator"></div>
            <?php 
osc_current_admin_theme_path('include/backoffice_menu.php');
?>
            <div id="right_column">
                <div id="content_header" class="content_header">
                    <div style="float: left;">
                        <img src="<?php 
echo osc_current_admin_theme_url('images/admin-icon.png');
?>
" title="" alt="" />
                    </div>
                    <div id="content_header_arrow">&raquo; <?php 
_e('Add new admin');
?>
</div>
                    <div style="clear: both;"></div>
                </div>
                <div id="content_separator"></div>
                <?php 
osc_show_flash_message('admin');
?>
                <div id="settings_form" style="border: 1px solid #ccc; background: #eee; ">
                    <div style="padding: 20px;">
예제 #29
0
 function doModel()
 {
     parent::doModel();
     //specific things for this class
     switch ($this->action) {
         case 'add':
             $this->doView("plugins/add.php");
             break;
         case 'add_post':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             }
             osc_csrf_check();
             $package = Params::getFiles("package");
             if (isset($package['size']) && $package['size'] != 0) {
                 $path = osc_plugins_path();
                 (int) ($status = osc_unzip_file($package['tmp_name'], $path));
                 @unlink($package['tmp_name']);
             } else {
                 $status = 3;
             }
             switch ($status) {
                 case 0:
                     $msg = _m('The plugin folder is not writable');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 1:
                     $msg = _m('The plugin has been uploaded correctly');
                     osc_add_flash_ok_message($msg, 'admin');
                     break;
                 case 2:
                     $msg = _m('The zip file is not valid');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
                 case 3:
                     $msg = _m('No file was uploaded');
                     osc_add_flash_error_message($msg, 'admin');
                     $this->redirectTo(osc_admin_base_url(true) . "?page=plugins&action=add");
                     break;
                 case -1:
                 default:
                     $msg = _m('There was a problem adding the plugin');
                     osc_add_flash_error_message($msg, 'admin');
                     break;
             }
             $this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
             break;
         case 'install':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             }
             osc_csrf_check();
             $pn = Params::getParam('plugin');
             // set header just in case it's triggered some fatal error
             header("Location: " . osc_admin_base_url(true) . "?page=plugins&error=" . $pn, true, '302');
             $installed = Plugins::install($pn);
             if (is_array($installed)) {
                 switch ($installed['error_code']) {
                     case 'error_output':
                         osc_add_flash_error_message(sprintf(_m('The plugin generated %d characters of <strong>unexpected output</strong> during the installation. Output: "%s"'), strlen($installed['output']), $installed['output']), 'admin');
                         break;
                     case 'error_installed':
                         osc_add_flash_error_message(_m('Plugin is already installed'), 'admin');
                         break;
                     case 'error_file':
                         osc_add_flash_error_message(_m("Plugin couldn't be installed because their files are missing"), 'admin');
                         break;
                     case 'custom_error':
                         osc_add_flash_error_message(sprintf(_m("Plugin couldn't be installed because of: %s"), $installed['msg']), 'admin');
                         break;
                     default:
                         osc_add_flash_error_message(_m("Plugin couldn't be installed"), 'admin');
                         break;
                 }
             } else {
                 osc_add_flash_ok_message(_m('Plugin installed'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             break;
         case 'uninstall':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             }
             osc_csrf_check();
             if (Plugins::uninstall(Params::getParam("plugin"))) {
                 osc_add_flash_ok_message(_m('Plugin uninstalled'), 'admin');
             } else {
                 osc_add_flash_error_message(_m("Plugin couldn't be uninstalled"), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             break;
         case 'enable':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             }
             osc_csrf_check();
             if (Plugins::activate(Params::getParam('plugin'))) {
                 osc_add_flash_ok_message(_m('Plugin enabled'), 'admin');
             } else {
                 osc_add_flash_error_message(_m('Plugin is already enabled'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             break;
         case 'disable':
             if (defined('DEMO')) {
                 osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             }
             osc_csrf_check();
             if (Plugins::deactivate(Params::getParam('plugin'))) {
                 osc_add_flash_ok_message(_m('Plugin disabled'), 'admin');
             } else {
                 osc_add_flash_error_message(_m('Plugin is already disabled'), 'admin');
             }
             $this->redirectTo(osc_admin_base_url(true) . '?page=plugins');
             break;
         case 'admin':
             $plugin = Params::getParam("plugin");
             if ($plugin != "") {
                 osc_run_hook($plugin . '_configure');
             }
             break;
         case 'admin_post':
             osc_run_hook('admin_post');
             break;
         case 'renderplugin':
             if (Params::existParam('route')) {
                 $routes = Rewrite::newInstance()->getRoutes();
                 $rid = Params::getParam('route');
                 $file = '../';
                 if (isset($routes[$rid]) && isset($routes[$rid]['file'])) {
                     $file = $routes[$rid]['file'];
                 }
             } else {
                 // DEPRECATED: Disclosed path in URL is deprecated, use routes instead
                 // This will be REMOVED in 3.4
                 $file = Params::getParam('file');
                 // We pass the GET variables (in case we have somes)
                 if (preg_match('|(.+?)\\?(.*)|', $file, $match)) {
                     $file = $match[1];
                     if (preg_match_all('|&([^=]+)=([^&]*)|', urldecode('&' . $match[2] . '&'), $get_vars)) {
                         for ($var_k = 0; $var_k < count($get_vars[1]); $var_k++) {
                             Params::setParam($get_vars[1][$var_k], $get_vars[2][$var_k]);
                         }
                     }
                 } else {
                     $file = Params::getParam('file');
                 }
             }
             osc_run_hook('renderplugin_controller');
             if (stripos($file, '../') === false && stripos($file, '..\\') === false && $file != "") {
                 $this->_exportVariableToView("file", osc_plugins_path() . $file);
                 $this->doView("plugins/view.php");
             }
             break;
         case 'configure':
             $plugin = Params::getParam("plugin");
             if ($plugin != '') {
                 $plugin_data = Plugins::getInfo($plugin);
                 $this->_exportVariableToView("categories", Category::newInstance()->toTreeAll());
                 $this->_exportVariableToView("selected", PluginCategory::newInstance()->listSelected($plugin_data['short_name']));
                 $this->_exportVariableToView("plugin_data", $plugin_data);
                 $this->doView("plugins/configuration.php");
             } else {
                 $this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
             }
             break;
         case 'configure_post':
             osc_csrf_check();
             $plugin_short_name = Params::getParam("plugin_short_name");
             $categories = Params::getParam("categories");
             if ($plugin_short_name != "") {
                 Plugins::cleanCategoryFromPlugin($plugin_short_name);
                 if (isset($categories)) {
                     Plugins::addToCategoryPlugin($categories, $plugin_short_name);
                 }
                 osc_run_hook('plugin_categories_' . Params::getParam('plugin'), $categories);
                 osc_add_flash_ok_message(_m('Configuration was saved'), 'admin');
                 $this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
             }
             osc_add_flash_error_message(_m('No plugin selected'), 'admin');
             $this->doView('plugins/index.php');
             break;
         case 'delete':
             osc_csrf_check();
             $plugin = str_replace('/index.php', '', Params::getParam("plugin"));
             $path = preg_replace('([\\/]+)', '/', CONTENT_PATH . 'plugins/' . $plugin);
             if ($plugin != "" && strpos($plugin, '../') === false && strpos($plugin, '..\\') === false && $path != CONTENT_PATH . 'plugins/') {
                 if (osc_deleteDir($path)) {
                     osc_add_flash_ok_message(_m('The files were deleted'), 'admin');
                 } else {
                     osc_add_flash_error_message(sprintf(_m('There were an error deleting the files, please check the permissions of the files in %s'), $path . "/"), 'admin');
                 }
                 $this->redirectTo(osc_admin_base_url(true) . "?page=plugins");
             }
             osc_add_flash_error_message(_m('No plugin selected'), 'admin');
             $this->doView('plugins/index.php');
             break;
         case 'error_plugin':
             // force php errors and simulate plugin installation to show the errors in the iframe
             if (!OSC_DEBUG) {
                 error_reporting(E_ALL | E_STRICT);
             }
             @ini_set('display_errors', 1);
             include osc_plugins_path() . Params::getParam('plugin');
             Plugins::install(Params::getParam('plugin'));
             exit;
             break;
         default:
             if (Params::getParam('checkUpdated') != '') {
                 osc_admin_toolbar_update_plugins(true);
             }
             if (Params::getParam('iDisplayLength') == '') {
                 Params::setParam('iDisplayLength', 25);
             }
             $this->_exportVariableToView('iDisplayLength', Params::getParam('iDisplayLength'));
             $p_iPage = 1;
             if (is_numeric(Params::getParam('iPage')) && Params::getParam('iPage') >= 1) {
                 $p_iPage = Params::getParam('iPage');
             }
             Params::setParam('iPage', $p_iPage);
             $aPlugin = Plugins::listAll();
             $active_plugins = osc_get_plugins();
             // pagination
             $start = ($p_iPage - 1) * Params::getParam('iDisplayLength');
             $limit = Params::getParam('iDisplayLength');
             $count = count($aPlugin);
             $displayRecords = $limit;
             if ($start + $limit > $count) {
                 $displayRecords = $start + $limit - $count;
             }
             // --------------------------------------------------------
             $aData = array();
             $aInfo = array();
             $max = $start + $limit;
             if ($max > $count) {
                 $max = $count;
             }
             $aPluginsToUpdate = json_decode(osc_get_preference('plugins_to_update'));
             $bPluginsToUpdate = is_array($aPluginsToUpdate) ? true : false;
             for ($i = $start; $i < $max; $i++) {
                 $plugin = $aPlugin[$i];
                 $row = array();
                 $pInfo = osc_plugin_get_info($plugin);
                 // prepare row 1
                 $installed = 0;
                 if (osc_plugin_is_installed($plugin)) {
                     $installed = 1;
                 }
                 $enabled = 0;
                 if (osc_plugin_is_enabled($plugin)) {
                     $enabled = 1;
                 }
                 // prepare row 2
                 $sUpdate = '';
                 // get plugins to update from t_preference
                 if ($bPluginsToUpdate) {
                     if (in_array(@$pInfo['plugin_update_uri'], $aPluginsToUpdate)) {
                         $sUpdate = '<a class="market_update market-popup" href="#' . htmlentities($pInfo['plugin_update_uri']) . '">' . __("There's a new update available") . '</a>';
                     }
                 }
                 // prepare row 4
                 $sConfigure = '';
                 if (isset($active_plugins[$plugin . '_configure'])) {
                     $sConfigure = '<a href="' . osc_admin_base_url(true) . '?page=plugins&amp;action=admin&amp;plugin=' . $pInfo['filename'] . "&amp;" . osc_csrf_token_url() . '">' . __('Configure') . '</a>';
                 }
                 // prepare row 5
                 $sEnable = '';
                 if ($installed) {
                     if ($enabled) {
                         $sEnable = '<a href="' . osc_admin_base_url(true) . '?page=plugins&amp;action=disable&amp;plugin=' . $pInfo['filename'] . "&amp;" . osc_csrf_token_url() . '">' . __('Disable') . '</a>';
                     } else {
                         $sEnable = '<a href="' . osc_admin_base_url(true) . '?page=plugins&amp;action=enable&amp;plugin=' . $pInfo['filename'] . "&amp;" . osc_csrf_token_url() . '">' . __('Enable') . '</a>';
                     }
                 }
                 // prepare row 6
                 if ($installed) {
                     $sInstall = '<a onclick="javascript:return uninstall_dialog(\'' . $pInfo['filename'] . '\', \'' . $pInfo['plugin_name'] . '\');" href="' . osc_admin_base_url(true) . '?page=plugins&amp;action=uninstall&amp;plugin=' . $pInfo['filename'] . "&amp;" . osc_csrf_token_url() . '">' . __('Uninstall') . '</a>';
                 } else {
                     $sInstall = '<a href="' . osc_admin_base_url(true) . '?page=plugins&amp;action=install&amp;plugin=' . $pInfo['filename'] . "&amp;" . osc_csrf_token_url() . '">' . __('Install') . '</a>';
                 }
                 $sDelete = '';
                 if (!$installed) {
                     $sDelete = '<a href="javascript:delete_plugin(\'' . $pInfo['filename'] . '\');" >' . __('Delete') . '</a>';
                 }
                 $sHelp = '';
                 if ($pInfo['support_uri'] != '') {
                     $sHelp = '<span class="plugin-support-icon plugin-tooltip" ><a target="_blank" href="' . osc_sanitize_url($pInfo['support_uri']) . '" ><img src="' . osc_current_admin_theme_url('images/question.png') . '" alt="' . osc_esc_html(__('Problems with this plugin? Ask for support.')) . '" ></a></span>';
                 }
                 $sSiteUrl = '';
                 if ($pInfo['plugin_uri'] != '') {
                     $sSiteUrl = ' | <a target="_blank" href="' . $pInfo['plugin_uri'] . '">' . __('Plugins Site') . '</a>';
                 }
                 if ($pInfo['author_uri'] != '') {
                     $sAuthor = __('By') . ' <a target="_blank" href="' . $pInfo['author_uri'] . '">' . $pInfo['author'] . '</a>';
                 } else {
                     $sAuthor = __('By') . ' ' . $pInfo['author'];
                 }
                 $row[] = '<input type="hidden" name="installed" value="' . $installed . '" enabled="' . $enabled . '" />' . $pInfo['plugin_name'] . $sHelp . '<div>' . $sUpdate . '</div>';
                 $row[] = $pInfo['description'] . '<br />' . __('Version:') . $pInfo['version'] . ' | ' . $sAuthor . $sSiteUrl;
                 $row[] = $sUpdate != '' ? $sUpdate : '&nbsp;';
                 $row[] = $sConfigure != '' ? $sConfigure : '&nbsp;';
                 $row[] = $sEnable != '' ? $sEnable : '&nbsp;';
                 $row[] = $sInstall != '' ? $sInstall : '&nbsp;';
                 $row[] = $sDelete != '' ? $sDelete : '&nbsp;';
                 $aData[] = $row;
                 if (@$pInfo['plugin_update_uri'] != '') {
                     $aInfo[@$pInfo['plugin_update_uri']] = $pInfo;
                 } else {
                     $aInfo[$i] = $pInfo;
                 }
             }
             $array['iTotalRecords'] = $displayRecords;
             $array['iTotalDisplayRecords'] = count($aPlugin);
             $array['iDisplayLength'] = $limit;
             $array['aaData'] = $aData;
             $array['aaInfo'] = $aInfo;
             // --------------------------------------------------------
             $page = (int) Params::getParam('iPage');
             if (count($array['aaData']) == 0 && $page != 1) {
                 $total = (int) $array['iTotalDisplayRecords'];
                 $maxPage = ceil($total / (int) $array['iDisplayLength']);
                 $url = osc_admin_base_url(true) . '?' . Params::getServerParam('QUERY_STRING', false, false);
                 if ($maxPage == 0) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=1', $url);
                     $this->redirectTo($url);
                 }
                 if ($page > 1) {
                     $url = preg_replace('/&iPage=(\\d)+/', '&iPage=' . $maxPage, $url);
                     $this->redirectTo($url);
                 }
             }
             $this->_exportVariableToView('aPlugins', $array);
             $this->doView("plugins/index.php");
             break;
     }
 }