当前位置: 首页>>代码示例>>PHP>>正文


PHP Page::newInstance方法代码示例

本文整理汇总了PHP中Page::newInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::newInstance方法的具体用法?PHP Page::newInstance怎么用?PHP Page::newInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Page的用法示例。


在下文中一共展示了Page::newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: osc_has_static_pages_seo

function osc_has_static_pages_seo()
{
    if (!View::newInstance()->_exists('pages')) {
        View::newInstance()->_exportVariableToView('pages', Page::newInstance()->listAll(false, 0));
    }
    $page = View::newInstance()->_next('pages');
    View::newInstance()->_exportVariableToView('page_meta', json_decode($page['s_meta'], true));
    return $page;
}
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:9,代码来源:pages.php

示例2: table

 public function table($params)
 {
     $this->addTableHeader();
     $start = ((int) $params['iPage'] - 1) * $params['iDisplayLength'];
     $this->start = intval($start);
     $this->limit = intval($params['iDisplayLength']);
     $pages = Page::newInstance()->listAll(0, null, null, $this->start, $this->limit);
     $this->processData($pages);
     $this->total = Page::newInstance()->count(0);
     $this->total_filtered = $this->total;
     return $this->getData();
 }
开发者ID:mylastof,项目名称:os-class,代码行数:12,代码来源:PagesDataTable.php

示例3: __construct

 function __construct($params)
 {
     $this->_get = $params;
     $p_iPage = 1;
     if (!is_numeric(Params::getParam('iPage')) || Params::getParam('iPage') < 1) {
         $this->_get['iPage'] = $p_iPage;
         Params::setParam('iPage', $p_iPage);
     }
     // set start and limit using iPage param
     $start = ((int) $this->_get['iPage'] - 1) * $this->_get['iDisplayLength'];
     $this->start = intval($start);
     $this->limit = intval($this->_get['iDisplayLength']);
     $this->pages = Page::newInstance()->listAll(0, null, $this->start, $this->limit);
     $this->total = Page::newInstance()->count(0);
     $this->total_filtered = $this->total;
 }
开发者ID:semul,项目名称:Osclass,代码行数:16,代码来源:pages_processing.php

示例4: update

 /**
  * Generates emails from the templates & datas.
  *  - For each emails and for each active locale :
  *  	- Check if the emails is empty or does not exists anymore. If so, do nothing.
  *  	- Combines templates and datas to produce the s_title and s_text fields.
  * 	- Saves those settings for next run.
  * @return void.
  */
 public function update()
 {
     // Decode and transform into a PHP array (true as a second parameter).
     $data = json_decode(Params::getParam("email_datas", false, false), true);
     if (!is_array($data)) {
         mdh_handle_error(sprintf(__("Given JSON datas are not correct (Error #%d)", mdh_current_plugin_name()), json_last_error()), mdh_emailmagick_url());
     }
     // Get the HTML template.
     $template = Params::getParam("email_template", false, false);
     // This is current emails datas (stored in the database).
     $currentDatas = json_decode(osc_get_preference("email_datas", mdh_current_preferences_section()), true);
     // Create a new array, merge of the old and the new one.
     $newDatas = array("emails" => array(), "footer" => array("locales" => Madhouse_EmailMagick_Utils::mergeLocales($currentDatas["footer"]["locales"], $data["footer"]["locales"])));
     // Iterate through new submitted emails data to update.
     $i = 0;
     foreach ($data["emails"] as $e) {
         // Get the old email datas, as they are right now.
         $oe = Madhouse_Utils_Collections::findByField($currentDatas["emails"], "s_internal_name", $e["s_internal_name"]);
         if (is_null($oe)) {
             // Not found in old emails. => new email has been installed.
             $locales = $e["locales"];
         } else {
             // Found in old emails. Merge with new locales.
             $locales = Madhouse_EmailMagick_Utils::mergeLocales($oe["locales"], $e["locales"]);
         }
         // Email exists, create in order to be filled and pushed to the new datas (at the end).
         $nEmail = array("s_internal_name" => $e["s_internal_name"], "locales" => $locales);
         // Get the email from the database.
         $email = Page::newInstance()->findByInternalName($e["s_internal_name"]);
         if ($email !== false && count($email) > 0) {
             // Update the email.
             $updated = Madhouse_EmailMagick_Models_Emails::newInstance()->update($template, $email["pk_i_id"], $newDatas, $nEmail);
             $i += $updated;
         }
         array_push($newDatas["emails"], $nEmail);
     }
     // Saves the settings.
     Madhouse_Utils_Controllers::doSettingsPost(array("email_template", "email_datas"), array("email_template" => $template, "email_datas" => json_encode($newDatas)), mdh_emailmagick_url(), null, sprintf(__("Sucessfully updated %d emails (out of %d)!", mdh_current_plugin_name()), $i, count($data["emails"]) * count(osc_get_locales())));
 }
开发者ID:bomvendador,项目名称:soroka_r,代码行数:47,代码来源:Admin.php

示例5: __construct

 function __construct()
 {
     parent::__construct();
     //specific things for this class
     $this->pageManager = Page::newInstance();
 }
开发者ID:randomecho,项目名称:OSClass,代码行数:6,代码来源:pages.php

示例6: moreedit_moderate_edit

function moreedit_moderate_edit($item_)
{
    $cat_id = $item_['fk_i_category_id'];
    $item_id = $item_['pk_i_id'];
    if (osc_get_preference('notify_edit', 'moreedit') == '1') {
        $aPage = Page::newInstance()->findByInternalName('email_moreedit_notify_edit');
        $content = array();
        $locale = osc_current_user_locale();
        if (isset($aPage['locale'][$locale]['s_title'])) {
            $content = $aPage['locale'][$locale];
        } else {
            $content = current($aPage['locale']);
        }
        $item = Item::newInstance()->findByPrimaryKey($item_id);
        View::newInstance()->_exportVariableToView('item', $item);
        $item_url = osc_item_url();
        $item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
        $admin_edit_url = osc_item_admin_edit_url($item['pk_i_id']);
        $words = array();
        $words[] = array('{EDIT_LINK}', '{EDIT_URL}', '{ITEM_DESCRIPTION}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}');
        $words[] = array('<a href="' . $admin_edit_url . '" >' . $admin_edit_url . '</a>', $admin_edit_url, $item['s_description'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title());
        $title = osc_mailBeauty($content['s_title'], $words);
        $body = osc_mailBeauty($content['s_text'], $words);
        $emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
        osc_sendMail($emailParams);
    }
    if (osc_get_preference('moderate_edit', 'moreedit') == '1') {
        Item::newInstance()->update(array('b_enabled' => 0), array('pk_i_id' => $item_id));
    }
}
开发者ID:syedfiraat4,项目名称:bikade.com,代码行数:30,代码来源:index.php

示例7: oc_install_example_data

function oc_install_example_data()
{
    require_once LIB_PATH . 'osclass/formatting.php';
    require LIB_PATH . 'osclass/installer/basic_data.php';
    require_once LIB_PATH . 'osclass/model/Category.php';
    $mCat = Category::newInstance();
    if (!function_exists('osc_apply_filter')) {
        function osc_apply_filter($dummyfilter, $str)
        {
            return $str;
        }
    }
    foreach ($categories as $category) {
        $fields['pk_i_id'] = $category['pk_i_id'];
        $fields['fk_i_parent_id'] = $category['fk_i_parent_id'];
        $fields['i_position'] = $category['i_position'];
        $fields['i_expiration_days'] = 0;
        $fields['b_enabled'] = 1;
        $aFieldsDescription[osc_current_admin_locale()]['s_name'] = $category['s_name'];
        $mCat->insert($fields, $aFieldsDescription);
    }
    require_once LIB_PATH . 'osclass/model/Item.php';
    require_once LIB_PATH . 'osclass/model/ItemComment.php';
    require_once LIB_PATH . 'osclass/model/ItemLocation.php';
    require_once LIB_PATH . 'osclass/model/ItemResource.php';
    require_once LIB_PATH . 'osclass/model/ItemStats.php';
    require_once LIB_PATH . 'osclass/model/User.php';
    require_once LIB_PATH . 'osclass/model/Country.php';
    require_once LIB_PATH . 'osclass/model/Region.php';
    require_once LIB_PATH . 'osclass/model/City.php';
    require_once LIB_PATH . 'osclass/model/CityArea.php';
    require_once LIB_PATH . 'osclass/model/Field.php';
    require_once LIB_PATH . 'osclass/model/Page.php';
    require_once LIB_PATH . 'osclass/model/Log.php';
    require_once LIB_PATH . 'osclass/model/CategoryStats.php';
    require_once LIB_PATH . 'osclass/model/CountryStats.php';
    require_once LIB_PATH . 'osclass/model/RegionStats.php';
    require_once LIB_PATH . 'osclass/model/CityStats.php';
    require_once LIB_PATH . 'osclass/helpers/hSecurity.php';
    require_once LIB_PATH . 'osclass/helpers/hValidate.php';
    require_once LIB_PATH . 'osclass/helpers/hUsers.php';
    require_once LIB_PATH . 'osclass/ItemActions.php';
    $mItem = new ItemActions(true);
    foreach ($item as $k => $v) {
        if ($k == 'description' || $k == 'title') {
            Params::setParam($k, array(osc_current_admin_locale() => $v));
        } else {
            Params::setParam($k, $v);
        }
    }
    $mItem->prepareData(true);
    $successItem = $mItem->add();
    $successPageresult = Page::newInstance()->insert(array('s_internal_name' => $page['s_internal_name'], 'b_indelible' => 0, 's_meta' => json_encode('')), array(osc_current_admin_locale() => array('s_title' => $page['s_title'], 's_text' => $page['s_text'])));
}
开发者ID:mylastof,项目名称:os-class,代码行数:54,代码来源:install-functions.php

示例8: osc_has_static_pages

/**
 * Let you know if there are more static pages in the list. If static pages are not loaded, this function will load them.
 *
 * @return <boolean>
 */
function osc_has_static_pages()
{
    if (!View::newInstance()->_exists('pages')) {
        View::newInstance()->_exportVariableToView('pages', Page::newInstance()->listAll(false));
    }
    return View::newInstance()->_next('pages');
}
开发者ID:hashemgamal,项目名称:OSClass,代码行数:12,代码来源:hPage.php

示例9: doModel

 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('Y-m-d H:i:s'), 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 'categories_order':
             // Save the order of the categories
             osc_csrf_check(false);
             $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
//.........这里部分代码省略.........
开发者ID:jmcclenon,项目名称:Osclass,代码行数:101,代码来源:ajax.php

示例10: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'dashboard':
             //dashboard...
             $max_items = Params::getParam('max_items') != '' ? Params::getParam('max_items') : 5;
             $aItems = Item::newInstance()->findByUserID(Session::newInstance()->_get('userId'), 0, $max_items);
             //Item::newInstance()->listWhere("fk_i_user_id = ".Session::newInstance()->_get('userId'));
             //calling the view...
             $this->_exportVariableToView('items', $aItems);
             $this->_exportVariableToView('max_items', $max_items);
             $this->doView('user-dashboard.php');
             break;
         case 'profile':
             //profile...
             $user = User::newInstance()->findByPrimaryKey(Session::newInstance()->_get('userId'));
             $aCountries = Country::newInstance()->listAll();
             $aRegions = array();
             if ($user['fk_c_country_code'] != '') {
                 $aRegions = Region::newInstance()->getByCountry($user['fk_c_country_code']);
             } elseif (count($aCountries) > 0) {
                 $aRegions = Region::newInstance()->getByCountry($aCountries[0]['pk_c_code']);
             }
             $aCities = array();
             if ($user['fk_i_region_id'] != '') {
                 $aCities = City::newInstance()->listWhere("fk_i_region_id = %d", $user['fk_i_region_id']);
             } else {
                 if (count($aRegions) > 0) {
                     $aCities = City::newInstance()->listWhere("fk_i_region_id = %d", $aRegions[0]['pk_i_id']);
                 }
             }
             //calling the view...
             $this->_exportVariableToView('countries', $aCountries);
             $this->_exportVariableToView('regions', $aRegions);
             $this->_exportVariableToView('cities', $aCities);
             $this->_exportVariableToView('user', $user);
             $this->doView('user-profile.php');
             break;
         case 'profile_post':
             //profile post...
             $userId = Session::newInstance()->_get('userId');
             require_once LIB_PATH . 'osclass/UserActions.php';
             $userActions = new UserActions(false);
             $success = $userActions->edit($userId);
             // This has been moved to special area (only password changes)
             /*if( $success == 1 ) {
                   osc_add_flash_message( _m('Passwords don\'t match') ) ;
               } else {*/
             osc_add_flash_message(_m('Your profile has been updated successfully'));
             //}
             $this->redirectTo(osc_user_profile_url());
             break;
         case 'alerts':
             //alerts
             $aAlerts = Alerts::newInstance()->getAlertsFromUser(Session::newInstance()->_get('userId'));
             $user = User::newInstance()->findByPrimaryKey(Session::newInstance()->_get('userId'));
             foreach ($aAlerts as $k => $a) {
                 $search = osc_unserialize(base64_decode($a['s_search']));
                 $search->limit(0, 3);
                 $aAlerts[$k]['items'] = $search->doSearch();
             }
             $this->_exportVariableToView('alerts', $aAlerts);
             View::newInstance()->_reset('alerts');
             $this->_exportVariableToView('user', $user);
             $this->doView('user-alerts.php');
             break;
         case 'change_email':
             //change email
             $this->doView('user-change_email.php');
             break;
         case 'change_email_post':
             //change email post
             if (!preg_match("/^[_a-z0-9-\\+]+(\\.[_a-z0-9-\\+]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/", Params::getParam('new_email'))) {
                 osc_add_flash_message(_m('The specified e-mail is not valid'));
                 $this->redirectTo(osc_change_user_email_url());
             } else {
                 $user = User::newInstance()->findByEmail(Params::getParam('new_email'));
                 if (!isset($user['pk_i_id'])) {
                     if (osc_user_validation_enabled()) {
                         $userEmailTmp = array();
                         $userEmailTmp['fk_i_user_id'] = Session::newInstance()->_get('userId');
                         $userEmailTmp['s_new_email'] = Params::getParam('new_email');
                         UserEmailTmp::newInstance()->insertOrUpdate($userEmailTmp);
                         $code = osc_genRandomPassword(30);
                         $date = date('Y-m-d H:i:s');
                         $userManager = new User();
                         $userManager->update(array('s_pass_code' => $code, 's_pass_date' => $date, 's_pass_ip' => $_SERVER['REMOTE_ADDR']), array('pk_i_id' => Session::newInstance()->_get('userId')));
                         $locale = osc_current_user_locale();
                         $aPage = Page::newInstance()->findByInternalName('email_new_email');
                         if (isset($aPage['locale'][$locale]['s_title'])) {
                             $content = $aPage['locale'][$locale];
                         } else {
                             $content = current($aPage['locale']);
                         }
                         if (!is_null($content)) {
                             $validation_url = osc_change_user_email_confirm_url(Session::newInstance()->_get('userId'), $code);
                             $words = array();
                             $words[] = array('{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{WEB_TITLE}', '{VALIDATION_LINK}', '{VALIDATION_URL}');
                             $words[] = array(Session::newInstance()->_get('userName'), Params::getParam('new_email'), osc_base_url(), osc_page_title(), '<a href="' . $validation_url . '" >' . $validation_url . '</a>', $validation_url);
                             $title = osc_mailBeauty($content['s_title'], $words);
//.........这里部分代码省略.........
开发者ID:hashemgamal,项目名称:OSClass,代码行数:101,代码来源:user.php

示例11: uninstall

 /**
  * Remove data and tables related to the plugin.
  */
 public function uninstall()
 {
     Page::newInstance()->deleteByInternalName('email_moreedit_notify_edit');
 }
开发者ID:syedfiraat4,项目名称:bikade.com,代码行数:7,代码来源:ModelMoreedit.php

示例12: doModel

 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('Y-m-d H:i:s'), 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 'categories_order':
             // Save the order of the categories
             osc_csrf_check(false);
             $aIds = Params::getParam('list');
             $order = array();
             $error = 0;
             $catManager = Category::newInstance();
             $aRecountCat = array();
             foreach ($aIds as $cat) {
                 if (!isset($order[$cat['p']])) {
                     $order[$cat['p']] = 0;
                 }
                 $res = $catManager->update(array('fk_i_parent_id' => $cat['p'] == 'root' ? NULL : $cat['p'], 'i_position' => $order[$cat['p']]), array('pk_i_id' => $cat['c']));
                 if (is_bool($res) && !$res) {
                     $error = 1;
                 } else {
                     if ($res == 1) {
                         $aRecountCat[] = $cat['c'];
                     }
                 }
                 $order[$cat['p']] = $order[$cat['p']] + 1;
             }
             // update category stats
             foreach ($aRecountCat as $rId) {
                 osc_update_cat_stats_id($rId);
             }
             if ($error) {
                 $result = array('error' => __("An error occurred"));
             } else {
                 $result = array('ok' => __("Order saved"));
             }
             echo json_encode($result);
             break;
         case 'category_edit_iframe':
             $this->_exportVariableToView('category', Category::newInstance()->findByPrimaryKey(Params::getParam("id"), 'all'));
             if (count(Category::newInstance()->findSubcategories(Params::getParam("id"))) > 0) {
                 $this->_exportVariableToView('has_subcategories', true);
             } else {
                 $this->_exportVariableToView('has_subcategories', false);
             }
             $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) {
//.........这里部分代码省略.........
开发者ID:adrienrn,项目名称:Osclass,代码行数:101,代码来源:ajax.php

示例13: uninstall

 public function uninstall()
 {
     $confPath = PAYMENT_PRO_PATH . 'payments/';
     $dir = opendir($confPath);
     while ($file = readdir($dir)) {
         if (is_dir($confPath . $file) && $file != '.' && $file != '..') {
             if (file_exists($confPath . $file . '/load.php')) {
                 include_once $confPath . $file . '/load.php';
             }
         }
     }
     closedir($dir);
     osc_run_hook('payment_pro_pre_uninstall');
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_premium()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_publish()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_wallet()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_prices()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_invoice_row()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_invoice()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_pending_row()));
     $this->dao->query(sprintf('DROP TABLE %s', $this->getTable_mail_queue()));
     $page = Page::newInstance()->findByInternalName('payment_pro_email_payment');
     Page::newInstance()->deleteByPrimaryKey($page['pk_i_id']);
     Preference::newInstance()->delete(array('s_section' => 'payment_pro'));
     osc_run_hook('payment_pro_post_uninstall');
 }
开发者ID:michaelxizhou,项目名称:myeden69-original-backup,代码行数:26,代码来源:ModelPaymentPro.php

示例14: doModel

 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) {
//.........这里部分代码省略.........
开发者ID:nsswaga,项目名称:OSClass,代码行数:101,代码来源:ajax.php

示例15: doModel

 function doModel()
 {
     switch ($this->action) {
         case 'login_post':
             //post execution for the login
             $admin = Admin::newInstance()->findByUsername(Params::getParam('user'));
             if ($admin) {
                 if ($admin["s_password"] == sha1(Params::getParam('password'))) {
                     if (Params::getParam('remember')) {
                         //this include contains de osc_genRandomPassword function
                         require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
                         $secret = osc_genRandomPassword();
                         Admin::newInstance()->update(array('s_secret' => $secret), array('pk_i_id' => $admin['pk_i_id']));
                         Cookie::newInstance()->set_expires(osc_time_cookie());
                         Cookie::newInstance()->push('oc_adminId', $admin['pk_i_id']);
                         Cookie::newInstance()->push('oc_adminSecret', $secret);
                         Cookie::newInstance()->push('oc_adminLocale', Params::getParam('locale'));
                         Cookie::newInstance()->set();
                     }
                     //we are logged in... let's go!
                     Session::newInstance()->_set('adminId', $admin['pk_i_id']);
                     Session::newInstance()->_set('adminUserName', $admin['s_username']);
                     Session::newInstance()->_set('adminName', $admin['s_name']);
                     Session::newInstance()->_set('adminEmail', $admin['s_email']);
                     Session::newInstance()->_set('adminLocale', Params::getParam('locale'));
                 } else {
                     osc_add_flash_message(_m('The password is incorrect'), 'admin');
                 }
             } else {
                 osc_add_flash_message(_m('That username does not exist'), 'admin');
             }
             //returning logged in to the main page...
             $this->redirectTo(osc_admin_base_url());
             break;
         case 'recover':
             //form to recover the password (in this case we have the form in /gui/)
             //#dev.conquer: we cannot use the doView here and only here
             $this->doView('gui/recover.php');
             break;
         case 'recover_post':
             //post execution to recover the password
             $admin = Admin::newInstance()->findByEmail(Params::getParam('email'));
             if ($admin) {
                 if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
                     if (!osc_check_recaptcha()) {
                         osc_add_flash_message(_m('The Recaptcha code is wrong'), 'admin');
                         $this->redirectTo(osc_admin_base_url(true) . '?page=login&action=recover');
                         return false;
                         // BREAK THE PROCESS, THE RECAPTCHA IS WRONG
                     }
                 }
                 require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
                 $newPassword = osc_genRandomPassword(40);
                 Admin::newInstance()->update(array('s_secret' => $newPassword), array('pk_i_id' => $admin['pk_i_id']));
                 $password_link = osc_forgot_admin_password_confirm_url($admin['pk_i_id'], $newPassword);
                 $aPage = Page::newInstance()->findByInternalName('email_user_forgot_password');
                 $content = array();
                 $locale = osc_current_user_locale();
                 if (isset($aPage['locale'][$locale]['s_title'])) {
                     $content = $aPage['locale'][$locale];
                 } else {
                     $content = current($aPage['locale']);
                 }
                 if (!is_null($content)) {
                     $words = array();
                     $words[] = array('{USER_NAME}', '{USER_EMAIL}', '{WEB_TITLE}', '{IP_ADDRESS}', '{PASSWORD_LINK}', '{DATE_TIME}');
                     $words[] = array($admin['s_name'], $admin['s_email'], osc_page_title(), $_SERVER['REMOTE_ADDR'], $password_link, date(osc_time_format() . '  ' . osc_date_format()));
                     $title = osc_mailBeauty($content['s_title'], $words);
                     $body = osc_mailBeauty($content['s_text'], $words);
                     $emailParams = array('subject' => $title, 'to' => $admin['s_email'], 'to_name' => $admin['s_name'], 'body' => $body, 'alt_body' => $body);
                     osc_sendMail($emailParams);
                 }
             }
             osc_add_flash_message(_m('A new password has been sent to your e-mail'), 'admin');
             $this->redirectTo(osc_admin_base_url());
             break;
         case 'forgot':
             //form to recover the password (in this case we have the form in /gui/)
             $admin = Admin::newInstance()->findByIdSecret(Params::getParam('adminId'), Params::getParam('code'));
             if ($admin) {
                 $this->doView('gui/forgot_password.php');
             } else {
                 osc_add_flash_message(_m('Sorry, the link is not valid'), 'admin');
                 $this->redirectTo(osc_admin_base_url());
             }
             break;
         case 'forgot_post':
             $admin = Admin::newInstance()->findByIdSecret(Params::getParam('adminId'), Params::getParam('code'));
             if ($admin) {
                 if (Params::getParam('new_password') == Params::getParam('new_password2')) {
                     Admin::newInstance()->update(array('s_secret' => osc_genRandomPassword(), 's_password' => sha1(Params::getParam('new_password'))), array('pk_i_id' => $admin['pk_i_id']));
                     osc_add_flash_message(_m('The password has been changed'), 'admin');
                     $this->redirectTo(osc_admin_base_url());
                 } else {
                     osc_add_flash_message(_m('Error, the password don\'t match'), 'admin');
                     $this->redirectTo(osc_forgot_admin_password_confirm_url(Params::getParam('adminId'), Params::getParam('code')));
                 }
             } else {
                 osc_add_flash_message(_m('Sorry, the link is not valid'), 'admin');
             }
//.........这里部分代码省略.........
开发者ID:hashemgamal,项目名称:OSClass,代码行数:101,代码来源:login.php


注:本文中的Page::newInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。